[PATCH] net: ipv6: mcast: Removing invalid check

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE5582d

3 messages, 2 authors, 2011-05-14 · open the first message on its own page

[PATCH] net: ipv6: mcast: Removing invalid check

From: Maxin B John <hidden>
Date: 2011-05-14 13:43:21

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

Re: [PATCH] net: ipv6: mcast: Removing invalid check

From: Eric Dumazet <hidden>
Date: 2011-05-14 14:33:40

Le samedi 14 mai 2011 à 16:43 +0300, Maxin B John a écrit :
quoted hunk
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 <redacted>
---
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

Re: [PATCH] net: ipv6: mcast: Removing invalid check

From: Maxin B John <hidden>
Date: 2011-05-14 14:45:42

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help