2015-02-11 12:34:02

by Fengguang Wu

[permalink] [raw]
Subject: [PATCH] netfilter: ipset: fix boolreturn.cocci warnings

net/netfilter/xt_set.c:196:9-10: WARNING: return of 0/1 in function 'set_match_v3' with return type bool
net/netfilter/xt_set.c:242:9-10: WARNING: return of 0/1 in function 'set_match_v4' with return type bool

Return statements in functions returning bool should use
true/false instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

CC: Jozsef Kadlecsik <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
---

xt_set.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/netfilter/xt_set.c
+++ b/net/netfilter/xt_set.c
@@ -193,7 +193,7 @@ set_match_v3(const struct sk_buff *skb,
return ret;

if (!match_counter0(opt.ext.packets, &info->packets))
- return 0;
+ return false;
return match_counter0(opt.ext.bytes, &info->bytes);
}

@@ -239,7 +239,7 @@ set_match_v4(const struct sk_buff *skb,
return ret;

if (!match_counter(opt.ext.packets, &info->packets))
- return 0;
+ return false;
return match_counter(opt.ext.bytes, &info->bytes);
}


2015-02-11 14:37:06

by Pablo Neira Ayuso

[permalink] [raw]
Subject: Re: [PATCH] netfilter: ipset: fix boolreturn.cocci warnings

On Wed, Feb 11, 2015 at 08:33:05PM +0800, kbuild test robot wrote:
> net/netfilter/xt_set.c:196:9-10: WARNING: return of 0/1 in function 'set_match_v3' with return type bool
> net/netfilter/xt_set.c:242:9-10: WARNING: return of 0/1 in function 'set_match_v4' with return type bool
>
> Return statements in functions returning bool should use
> true/false instead of 1/0.
> Generated by: scripts/coccinelle/misc/boolreturn.cocci

Jozsef, unless you have any objection, I'm going to apply this.

Thanks.

> CC: Jozsef Kadlecsik <[email protected]>
> Signed-off-by: Fengguang Wu <[email protected]>
> ---
>
> xt_set.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/net/netfilter/xt_set.c
> +++ b/net/netfilter/xt_set.c
> @@ -193,7 +193,7 @@ set_match_v3(const struct sk_buff *skb,
> return ret;
>
> if (!match_counter0(opt.ext.packets, &info->packets))
> - return 0;
> + return false;
> return match_counter0(opt.ext.bytes, &info->bytes);
> }
>
> @@ -239,7 +239,7 @@ set_match_v4(const struct sk_buff *skb,
> return ret;
>
> if (!match_counter(opt.ext.packets, &info->packets))
> - return 0;
> + return false;
> return match_counter(opt.ext.bytes, &info->bytes);
> }
>

2015-02-11 14:58:10

by Jozsef Kadlecsik

[permalink] [raw]
Subject: Re: [PATCH] netfilter: ipset: fix boolreturn.cocci warnings

On Wed, 11 Feb 2015, Pablo Neira Ayuso wrote:

> On Wed, Feb 11, 2015 at 08:33:05PM +0800, kbuild test robot wrote:
> > net/netfilter/xt_set.c:196:9-10: WARNING: return of 0/1 in function 'set_match_v3' with return type bool
> > net/netfilter/xt_set.c:242:9-10: WARNING: return of 0/1 in function 'set_match_v4' with return type bool
> >
> > Return statements in functions returning bool should use
> > true/false instead of 1/0.
> > Generated by: scripts/coccinelle/misc/boolreturn.cocci
>
> Jozsef, unless you have any objection, I'm going to apply this.

No objection, just go ahead.

Acked-by: Jozsef Kadlecsik <[email protected]>

Best regards,
Jozsef

> > CC: Jozsef Kadlecsik <[email protected]>
> > Signed-off-by: Fengguang Wu <[email protected]>
> > ---
> >
> > xt_set.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > --- a/net/netfilter/xt_set.c
> > +++ b/net/netfilter/xt_set.c
> > @@ -193,7 +193,7 @@ set_match_v3(const struct sk_buff *skb,
> > return ret;
> >
> > if (!match_counter0(opt.ext.packets, &info->packets))
> > - return 0;
> > + return false;
> > return match_counter0(opt.ext.bytes, &info->bytes);
> > }
> >
> > @@ -239,7 +239,7 @@ set_match_v4(const struct sk_buff *skb,
> > return ret;
> >
> > if (!match_counter(opt.ext.packets, &info->packets))
> > - return 0;
> > + return false;
> > return match_counter(opt.ext.bytes, &info->bytes);
> > }
> >
>

-
E-mail : [email protected], [email protected]
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary