lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 24 Feb 2009 17:33:37 +0800
From:	Yang Hongyang <yanghy@...fujitsu.com>
To:	Wei Yongjun <yjwei@...fujitsu.com>
CC:	netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH] ipv6: Remove some pointless conditionals before kfree_skb()

Wei Yongjun wrote:
> 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>

I think kfree_skb() suppose that you have handled NULL pointer 
because it uses `unlikely` to check the pointer.
So I don't think these conditions are pointless...
 437 void kfree_skb(struct sk_buff *skb)
 438 {
 439         if (unlikely(!skb))
 440                 return;



> 
> Signed-off-by: Wei Yongjun <yjwei@...fujitsu.com>
> ---
>  net/ipv6/ipv6_sockglue.c |    3 +--
>  net/ipv6/tcp_ipv6.c      |    6 ++----
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
> index 40f3246..d31df0f 100644
> --- a/net/ipv6/ipv6_sockglue.c
> +++ b/net/ipv6/ipv6_sockglue.c
> @@ -218,8 +218,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
>  			if (opt)
>  				sock_kfree_s(sk, opt, opt->tot_len);
>  			pktopt = xchg(&np->pktoptions, NULL);
> -			if (pktopt)
> -				kfree_skb(pktopt);
> +			kfree_skb(pktopt);
>  
>  			sk->sk_destruct = inet_sock_destruct;
>  			/*
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index e5b85d4..273a5dd 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -533,8 +533,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
>  
>  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
> @@ -1611,8 +1610,7 @@ ipv6_pktoptions:
>  		}
>  	}
>  
> -	if (opt_skb)
> -		kfree_skb(opt_skb);
> +	kfree_skb(opt_skb);
>  	return 0;
>  }
>  


-- 
Regards
Yang Hongyang
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ