Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: mcast: Removing invalid check
@ 2011-05-14 13:43 Maxin B John
  2011-05-14 14:33 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Maxin B John @ 2011-05-14 13:43 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, kaber, yoshfuji, jmorris, pekkas, kuznet, davem

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)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv6: mcast: Removing invalid check
  2011-05-14 13:43 [PATCH] net: ipv6: mcast: Removing invalid check Maxin B John
@ 2011-05-14 14:33 ` Eric Dumazet
  2011-05-14 14:45   ` Maxin B John
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2011-05-14 14:33 UTC (permalink / raw)
  To: Maxin B John
  Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, pekkas, kuznet,
	davem

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv6: mcast: Removing invalid check
  2011-05-14 14:33 ` Eric Dumazet
@ 2011-05-14 14:45   ` Maxin B John
  0 siblings, 0 replies; 3+ messages in thread
From: Maxin B John @ 2011-05-14 14:45 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, linux-kernel, kaber, yoshfuji, jmorris, pekkas, kuznet,
	davem

Hi,

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

You are right.

> BTW "Removing invalid check" is a really wrong patch title.
>
> Once you can prove your point, you should use "Remove useless check"
>

I will keep it in mind. Thanks .

Best Regards,
Maxin B John

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-14 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-14 13:43 [PATCH] net: ipv6: mcast: Removing invalid check Maxin B John
2011-05-14 14:33 ` Eric Dumazet
2011-05-14 14:45   ` Maxin B John

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox