Skip to content

Commit

Permalink
net/enic: fix dereference before null check
Browse files Browse the repository at this point in the history
[ upstream commit a5f4298 ]

Move memcpy to 'ah->key' after 'ah' null check

Fixes: bb66d56 ("net/enic: share flow actions with same signature")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: John Daley <johndale@cisco.com>
  • Loading branch information
liwg06 authored and kevintraynor committed Feb 21, 2022
1 parent 57b2aa0 commit 90386f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/enic/enic_fm_flow.c
Expand Up @@ -2372,11 +2372,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);
Expand Down

0 comments on commit 90386f4

Please sign in to comment.