* [PATCH] ipv6: exthdrs: fix warning comparison to bool
@ 2019-06-08 8:35 Hariprasad Kelam
2019-06-10 2:54 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Hariprasad Kelam @ 2019-06-08 8:35 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev,
linux-kernel
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>
---
net/ipv6/exthdrs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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))
return false;
break;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: exthdrs: fix warning comparison to bool
2019-06-08 8:35 [PATCH] ipv6: exthdrs: fix warning comparison to bool Hariprasad Kelam
@ 2019-06-10 2:54 ` David Miller
2019-06-10 19:24 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-06-10 2:54 UTC (permalink / raw)
To: hariprasad.kelam; +Cc: kuznet, yoshfuji, netdev, linux-kernel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv6: exthdrs: fix warning comparison to bool
2019-06-10 2:54 ` David Miller
@ 2019-06-10 19:24 ` Joe Perches
0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2019-06-10 19:24 UTC (permalink / raw)
To: David Miller, hariprasad.kelam; +Cc: kuznet, yoshfuji, netdev, linux-kernel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-10 19:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-08 8:35 [PATCH] ipv6: exthdrs: fix warning comparison to bool Hariprasad Kelam
2019-06-10 2:54 ` David Miller
2019-06-10 19:24 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.