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: <1394431434.3607.6.camel@edumazet-glaptop2.roam.corp.google.com>
Date:	Sun, 09 Mar 2014 23:03:54 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	roy.qing.li@...il.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ipv4: use unlikely to optimise in ip_forward

On Mon, 2014-03-10 at 13:10 +0800, roy.qing.li@...il.com wrote:
> From: Li RongQing <roy.qing.li@...il.com>
> 
> The condition that skb->pkt_type is not PACKET_HOST in ip_forward, should never
> happen, so use unlikely to optimise this check
> 
> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
> ---
>  net/ipv4/ip_forward.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
> index be8abe7..b82833a 100644
> --- a/net/ipv4/ip_forward.c
> +++ b/net/ipv4/ip_forward.c
> @@ -128,7 +128,7 @@ int ip_forward(struct sk_buff *skb)
>  	struct ip_options *opt	= &(IPCB(skb)->opt);
>  
>  	/* that should never happen */
> -	if (skb->pkt_type != PACKET_HOST)
> +	if (unlikely(skb->pkt_type != PACKET_HOST))
>  		goto drop;
>  
>  	if (skb_warn_if_lro(skb))

Compilers already do the right thing.

This is one of the reason you see so many goto in the kernel.



--
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