From a5f42986968a0699e070c56f1033aee5f90d2c12 Mon Sep 17 00:00:00 2001 From: Weiguo Li Date: Tue, 25 Jan 2022 20:00:49 +0800 Subject: [PATCH] net/enic: fix dereference before null check Move memcpy to 'ah->key' after 'ah' null check Fixes: bb66d562aefc ("net/enic: share flow actions with same signature") Cc: stable@dpdk.org Signed-off-by: Weiguo Li Reviewed-by: John Daley --- drivers/net/enic/enic_fm_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c index bf04d714d0..d8718d17ef 100644 --- a/drivers/net/enic/enic_fm_flow.c +++ b/drivers/net/enic/enic_fm_flow.c @@ -2521,11 +2521,11 @@ enic_action_handle_get(struct enic_flowman *fm, struct fm_action *action_in, memcpy(fma, action_in, sizeof(*fma)); ah = calloc(1, sizeof(*ah)); - memcpy(&ah->key, action_in, sizeof(struct fm_action)); if (ah == NULL) return rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "enic: calloc(fm-action)"); + memcpy(&ah->key, action_in, sizeof(struct fm_action)); args[0] = FM_ACTION_ALLOC; args[1] = fm->cmd.pa; ret = flowman_cmd(fm, args, 2); -- 2.39.5