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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1df6e19ddadaedcfe67f47b93610778763bf63fa.camel@redhat.com>
Date:   Thu, 16 Feb 2023 13:15:27 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Gal Pressman <gal@...dia.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
        Tariq Toukan <tariqt@...dia.com>
Subject: Re: [PATCH net-next 2/2] skbuff: Add likely to skb pointer in
 build_skb()

On Wed, 2023-02-15 at 14:17 +0200, Gal Pressman wrote:
> Similarly to napi_build_skb(), it is likely the skb allocation in
> build_skb() succeeded.
> 
> Reviewed-by: Tariq Toukan <tariqt@...dia.com>
> Signed-off-by: Gal Pressman <gal@...dia.com>
> ---
>  net/core/skbuff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 069604b9ff9d..3aa9687d7546 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -420,7 +420,7 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size)
>  {
>  	struct sk_buff *skb = __build_skb(data, frag_size);
>  
> -	if (skb && frag_size) {
> +	if (likely(skb) && frag_size) {

I concur with Jakub: frag_size != 0 is a likely event. Additionally,
without including 'frag_size' into the likely() annotation the compiler
could consider the whole branch not likely: I think should be:

	if (likely(skb && frag_size)) {

Cheers,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ