Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Maxin B John <maxin.john@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kaber@trash.net, yoshfuji@linux-ipv6.org, jmorris@namei.org,
	pekkas@netcore.fi, kuznet@ms2.inr.ac.ru, davem@davemloft.net
Subject: Re: [PATCH] net: ipv6: mcast: Removing invalid check
Date: Sat, 14 May 2011 16:33:30 +0200	[thread overview]
Message-ID: <1305383610.3120.62.camel@edumazet-laptop> (raw)
In-Reply-To: <20110514134307.GA3603@maxin>

Le samedi 14 mai 2011 à 16:43 +0300, Maxin B John a écrit :
> Since the variable 'first' is assigned to 1, the check
> "if (truncate && !first)" will always be false.
> 
> Thanks to Coverity for spotting this issue.
> 
> Signed-off-by: Maxin B. John <maxin.john@gmail.com>
> ---
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 76b8937..441c1a4 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -1536,8 +1536,6 @@ static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
>  
>  		if (AVAILABLE(skb) < sizeof(*psrc) +
>  		    first*sizeof(struct mld2_grec)) {
> -			if (truncate && !first)
> -				break;	 /* truncate these */
>  			if (pgr)
>  				pgr->grec_nsrcs = htons(scount);
>  			if (skb)

At a first glance, I would say Coverity is wrong, unless you can explain
why it's right ;)

first can be 0 at this point, we are in a loop.

BTW "Removing invalid check" is a really wrong patch title.

Once you can prove your point, you should use "Remove useless check"

Thanks



  reply	other threads:[~2011-05-14 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-14 13:43 [PATCH] net: ipv6: mcast: Removing invalid check Maxin B John
2011-05-14 14:33 ` Eric Dumazet [this message]
2011-05-14 14:45   ` Maxin B John

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=1305383610.3120.62.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxin.john@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pekkas@netcore.fi \
    --cc=yoshfuji@linux-ipv6.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