[PATCH net-next] fib_rules: NULL check before kfree is not needed

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE2961d

2 messages, 2 authors, 2018-07-30 · open the first message on its own page

[PATCH net-next] fib_rules: NULL check before kfree is not needed

From: YueHaibing <hidden>
Date: 2018-07-30 13:08:11

kfree(NULL) is safe,so this removes NULL check before freeing the mem

Signed-off-by: YueHaibing <redacted>
---
 net/core/fib_rules.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index f64aa13..0ff3953 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -924,8 +924,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
 	return 0;
 
 errout:
-	if (nlrule)
-		kfree(nlrule);
+	kfree(nlrule);
 	rules_ops_put(ops);
 	return err;
 }
-- 
2.7.0

Re: [PATCH net-next] fib_rules: NULL check before kfree is not needed

From: David Miller <davem@davemloft.net>
Date: 2018-07-30 16:45:18

From: YueHaibing <redacted>
Date: Mon, 30 Jul 2018 21:07:24 +0800
kfree(NULL) is safe,so this removes NULL check before freeing the mem

Signed-off-by: YueHaibing <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help