diff mbox

netfilter: nft_counter: fix erroneous return values

Message ID 1454819479-6833-1-git-send-email-a.s.protopopov@gmail.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Anton Protopopov Feb. 7, 2016, 4:31 a.m. UTC
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>
---
 net/netfilter/nft_counter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso Feb. 15, 2016, 6:27 p.m. UTC | #1
On Sat, Feb 06, 2016 at 11:31:19PM -0500, Anton Protopopov wrote:
> The nft_counter_init() and nft_counter_clone() functions should return
> negative error value -ENOMEM instead of positive ENOMEM.

Applied, thanks.
diff mbox

Patch

diff --git a/net/netfilter/nft_counter.c b/net/netfilter/nft_counter.c
index c7808fc..c9743f7 100644
--- a/net/netfilter/nft_counter.c
+++ b/net/netfilter/nft_counter.c
@@ -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);
@@ -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);