netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH]  ipv6: xfrm6: fix dubious code
Date: Mon, 23 May 2011 08:36:00 -0700	[thread overview]
Message-ID: <1306164960.3456.42.camel@localhost> (raw)
In-Reply-To: <1306140167.2869.8.camel@edumazet-laptop>

On Mon, 2011-05-23 at 10:42 +0200, Eric Dumazet wrote:
> net/ipv6/xfrm6_tunnel.c: In function ‘xfrm6_tunnel_rcv’:
> net/ipv6/xfrm6_tunnel.c:244:53: warning: the omitted middle operand
> in ?: will always be ‘true’, suggest explicit middle operand
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  net/ipv6/xfrm6_tunnel.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
> index a6770a0..fb9b0c3 100644
> --- a/net/ipv6/xfrm6_tunnel.c
> +++ b/net/ipv6/xfrm6_tunnel.c
> @@ -241,7 +241,7 @@ static int xfrm6_tunnel_rcv(struct sk_buff *skb)
>  	__be32 spi;
>  
>  	spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr);
> -	return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? : 0;
> +	return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? 1 : 0;
>  }
>  
>  static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,

I suspect that this was intended to return the result of xfrm6_rcv_spi()
if > 0.  But if it really is intended to return the result of the
inequality, then the '?:' operation is not needed at all.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  reply	other threads:[~2011-05-23 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23  8:42 [PATCH] ipv6: xfrm6: fix dubious code Eric Dumazet
2011-05-23 15:36 ` Ben Hutchings [this message]
2011-05-23 20:33   ` David Miller
2011-05-24  5:02     ` Steffen Klassert
2011-05-24  5:12       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306164960.3456.42.camel@localhost \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).