提交 800d55f1 编写于 作者: W Wei Yongjun 提交者: David S. Miller

ipv6: Remove some pointless conditionals before kfree_skb()

Remove some pointless conditionals before kfree_skb().

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E;
@@
- if (E)
- 	kfree_skb(E);
+ kfree_skb(E);
// </smpl>
Signed-off-by: NWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1ce85fe4
...@@ -218,8 +218,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -218,8 +218,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
if (opt) if (opt)
sock_kfree_s(sk, opt, opt->tot_len); sock_kfree_s(sk, opt, opt->tot_len);
pktopt = xchg(&np->pktoptions, NULL); pktopt = xchg(&np->pktoptions, NULL);
if (pktopt) kfree_skb(pktopt);
kfree_skb(pktopt);
sk->sk_destruct = inet_sock_destruct; sk->sk_destruct = inet_sock_destruct;
/* /*
......
...@@ -533,8 +533,7 @@ static inline void syn_flood_warning(struct sk_buff *skb) ...@@ -533,8 +533,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
static void tcp_v6_reqsk_destructor(struct request_sock *req) static void tcp_v6_reqsk_destructor(struct request_sock *req)
{ {
if (inet6_rsk(req)->pktopts) kfree_skb(inet6_rsk(req)->pktopts);
kfree_skb(inet6_rsk(req)->pktopts);
} }
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
...@@ -1611,8 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -1611,8 +1610,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
} }
} }
if (opt_skb) kfree_skb(opt_skb);
kfree_skb(opt_skb);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册