Skip to content

Commit

Permalink
qdisc: meta return ENOMEM on alloc failure
Browse files Browse the repository at this point in the history
Rather than returning earlier value (EINVAL), return ENOMEM if
kzalloc fails. Found while reviewing to find another EINVAL condition.

Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Thomas Graf <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shemminger authored and davem330 committed Sep 30, 2013
1 parent 90de527 commit 0c4e402
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sched/em_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,10 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len,
goto errout;

meta = kzalloc(sizeof(*meta), GFP_KERNEL);
if (meta == NULL)
if (meta == NULL) {
err = -ENOMEM;
goto errout;
}

memcpy(&meta->lvalue.hdr, &hdr->left, sizeof(hdr->left));
memcpy(&meta->rvalue.hdr, &hdr->right, sizeof(hdr->right));
Expand Down

0 comments on commit 0c4e402

Please sign in to comment.