Skip to content

Commit

Permalink
netfilter: nft_counter: fix erroneous return values
Browse files Browse the repository at this point in the history
The nft_counter_init() and nft_counter_clone() functions should return
negative error value -ENOMEM instead of positive ENOMEM.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Anton Protopopov authored and Pablo Neira Ayuso committed Feb 8, 2016
1 parent 08a7f5d commit 5cc6ce9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nft_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int nft_counter_init(const struct nft_ctx *ctx,

cpu_stats = netdev_alloc_pcpu_stats(struct nft_counter_percpu);
if (cpu_stats == NULL)
return ENOMEM;
return -ENOMEM;

preempt_disable();
this_cpu = this_cpu_ptr(cpu_stats);
Expand Down Expand Up @@ -138,7 +138,7 @@ static int nft_counter_clone(struct nft_expr *dst, const struct nft_expr *src)
cpu_stats = __netdev_alloc_pcpu_stats(struct nft_counter_percpu,
GFP_ATOMIC);
if (cpu_stats == NULL)
return ENOMEM;
return -ENOMEM;

preempt_disable();
this_cpu = this_cpu_ptr(cpu_stats);
Expand Down

0 comments on commit 5cc6ce9

Please sign in to comment.