Skip to content

Commit

Permalink
net_sched: fix errno in tcindex_set_parms()
Browse files Browse the repository at this point in the history
When kmemdup() fails, we should return -ENOMEM.

Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
WANG Cong authored and David S. Miller committed Sep 28, 2014
1 parent c01035f commit 02c5e84
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/sched/cls_tcindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,14 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
if (err < 0)
return err;

err = -ENOMEM;
/* tcindex_data attributes must look atomic to classifier/lookup so
* allocate new tcindex data and RCU assign it onto root. Keeping
* perfect hash and hash pointers from old data.
*/
cp = kzalloc(sizeof(*cp), GFP_KERNEL);
if (!cp) {
err = -ENOMEM;
if (!cp)
goto errout;
}

cp->mask = p->mask;
cp->shift = p->shift;
Expand Down

0 comments on commit 02c5e84

Please sign in to comment.