Skip to contentSkip to conversation

ipv6: exthdrs: fix warning comparison to bool

PATCH In review Hariprasad Kelam 3 participants 3 messages Jun 8, 2019 – Jun 10, 2019

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

PATCH 1/1 ipv6: exthdrs: fix warning comparison to bool

Fix below warning reported by coccicheck

net/ipv6/exthdrs.c:180:9-29: WARNING: Comparison to bool

---
 net/ipv6/exthdrs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/exthdrs.c +1 -1
index ab5add0..e137325 100644
@@ -177,7 +177,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,
 					/* type specific length/alignment
 					   checks will be performed in the
 					   func(). */
-					if (curr->func(skb, off) == false)
+					if (!curr->func(skb, off))
 						return false;
 					break;
 				}
Signature · 1 line
2.7.4
maintainer
#1 lore raw

From: Hariprasad Kelam <[email protected]>
Date: Sat, 8 Jun 2019 14:05:33 +0530

Quoted 5 lines

Fix below warning reported by coccicheck

net/ipv6/exthdrs.c:180:9-29: WARNING: Comparison to bool

...

net/ipv6/exthdrs.c static bool ip6_parse_tlv(const struct tlvtype_proc *procs, · line 180

Quoted 10 lines
net/ipv6/exthdrs.c +1 -1
index ab5add0..e137325 100644
@@ -177,7 +177,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,
 					/* type specific length/alignment
 					   checks will be performed in the
 					   func(). */
-					if (curr->func(skb, off) == false)
+					if (!curr->func(skb, off))

curr->func() returns type 'bool', whats wrong with comparing against the same type?

I'm not applying stuff like this, sorry.

#2 lore raw
Quoted 23 lines · David Miller

From: Hariprasad Kelam <[email protected]>
Date: Sat, 8 Jun 2019 14:05:33 +0530

Quoted 5 lines

Fix below warning reported by coccicheck

net/ipv6/exthdrs.c:180:9-29: WARNING: Comparison to bool

...

net/ipv6/exthdrs.c static bool ip6_parse_tlv(const struct tlvtype_proc *procs, · line 180

Quoted 10 lines
net/ipv6/exthdrs.c +1 -1
index ab5add0..e137325 100644
@@ -177,7 +177,7 @@ static bool ip6_parse_tlv(const struct tlvtype_proc *procs,
                                      /* type specific length/alignment
                                         checks will be performed in the
                                         func(). */
-                                     if (curr->func(skb, off) == false)
+                                     if (!curr->func(skb, off))

curr->func() returns type 'bool', whats wrong with comparing against the same type?

Quoted 1 line

I'm not applying stuff like this, sorry.

Looking at the function, it seems odd to have some direct uses of "return false" and others of "goto bad" where bad: does kfree_skb.

If all of the direct uses of return false are correct, it could be useful to document why.