Messages in this thread | | | Subject | Re: [PATCH] ipv6: exthdrs: fix warning comparison to bool | From | Joe Perches <> | Date | Mon, 10 Jun 2019 12:24:58 -0700 |
| |
On Sun, 2019-06-09 at 19:54 -0700, David Miller wrote: > From: Hariprasad Kelam <hariprasad.kelam@gmail.com> > Date: Sat, 8 Jun 2019 14:05:33 +0530 > > > Fix below warning reported by coccicheck > > > > net/ipv6/exthdrs.c:180:9-29: WARNING: Comparison to bool > > > > Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com> > ... > > diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c > > index ab5add0..e137325 100644 > > --- a/net/ipv6/exthdrs.c > > +++ b/net/ipv6/exthdrs.c > > @@ -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.
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.
| |