net: ipv6: mcast: Removing invalid check
Subsystems (3)
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
@@ -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)
* 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.
Signed-off-by Maxin B. John <[email protected]>---
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@@ -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)
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
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.
Signed-off-by Maxin B. John <[email protected]>---
net/ipv6/mcast.c +0
-0
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
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