Skip to contentSkip to conversation

net: ipv6: mcast: Removing invalid check

PATCH In review Maxin B John 3 participants 5 messages May 14, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ipv6: mcast: Removing invalid check

Since the variable 'first' is assigned to 1, the check "if (truncate && !first)" will always be false.

Thanks to Coverity for spotting this issue.

---

net/ipv6/mcast.c +0 -2
index 76b8937..441c1a4 100644
@@ -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)
#1 lore raw

* Maxin B John <[email protected]>:

Quoted 7 lines

Since the variable 'first' is assigned to 1, the check "if (truncate && !first)" will always be false.

Thanks to Coverity for spotting this issue.

---

I don't see that. We are within a 'for' loop, and some lines below you will find an assignment of 'first = 0;'.

Best regards,
Nicolas Kaiser

Quoted 13 lines
net/ipv6/mcast.c +0 -2
index 76b8937..441c1a4 100644
@@ -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)
#2 lore raw

Ahhh.. Another bogus report from Coverity.

Quoted 4 lines

I don't see that. We are within a 'for' loop, and some lines below you will find an assignment of 'first = 0;'.

Thanks a lot for pointing it out.

Best Regards,
Maxin B John

#3 lore raw
In reply to Maxin B John
Quoted 12 lines · Maxin B John

Since the variable 'first' is assigned to 1, the check "if (truncate && !first)" will always be false.

Thanks to Coverity for spotting this issue.

---

net/ipv6/mcast.c +0 -0
index 76b8937..441c1a4 100644

net/ipv6/mcast.c static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, · line 1541

Quoted 8 lines
net/ipv6/mcast.c +0 -2
@@ -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

#4 lore raw

Hi,

Quoted 4 lines

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.

Quoted 4 lines

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