* Suspicious pattern for use of function xt_register_template()
@ 2021-08-23 17:01 Lukas Bulwahn
2021-08-23 19:10 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Bulwahn @ 2021-08-23 17:01 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, Linux Kernel Mailing List, Netdev, coreteam,
clang-built-linux
Dear Florian, dear netfilter maintainers,
Commit fdacd57c79b ("netfilter: x_tables: never register tables by
default") on linux-next
introduces the function xt_register_template() and in all cases but
one, the calls to that function are followed by:
if (ret < 0)
return ret;
All these checks were also added with the commit above.
In the one case, for iptable_mangle_init() in
./net/ipv4/netfilter/iptable_mangle.c, this pattern was not followed.
This makes this ret assignment in this function a Dead Store and
hence, clang-analyzer warns about that.
Are we missing here an early return for a negative return value as
well, or is this case for iptable_mangle_init() in
./net/ipv4/netfilter/iptable_mangle.c special?
Best regards,
Lukas
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Suspicious pattern for use of function xt_register_template()
2021-08-23 17:01 Suspicious pattern for use of function xt_register_template() Lukas Bulwahn
@ 2021-08-23 19:10 ` Florian Westphal
2021-08-23 20:28 ` Lukas Bulwahn
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2021-08-23 19:10 UTC (permalink / raw)
To: Lukas Bulwahn
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
netfilter-devel, Linux Kernel Mailing List, Netdev, coreteam,
clang-built-linux
Lukas Bulwahn <lukas.bulwahn@gmail.com> wrote:
> Dear Florian, dear netfilter maintainers,
>
> Commit fdacd57c79b ("netfilter: x_tables: never register tables by
> default") on linux-next
> introduces the function xt_register_template() and in all cases but
> one, the calls to that function are followed by:
>
> if (ret < 0)
> return ret;
>
> All these checks were also added with the commit above.
>
> In the one case, for iptable_mangle_init() in
> ./net/ipv4/netfilter/iptable_mangle.c, this pattern was not followed.
Thats a bug, the error test is missing.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Suspicious pattern for use of function xt_register_template()
2021-08-23 19:10 ` Florian Westphal
@ 2021-08-23 20:28 ` Lukas Bulwahn
0 siblings, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2021-08-23 20:28 UTC (permalink / raw)
To: Florian Westphal
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, netfilter-devel,
Linux Kernel Mailing List, Netdev, coreteam, clang-built-linux
On Mon, Aug 23, 2021 at 9:10 PM Florian Westphal <fw@strlen.de> wrote:
>
> Lukas Bulwahn <lukas.bulwahn@gmail.com> wrote:
> > Dear Florian, dear netfilter maintainers,
> >
> > Commit fdacd57c79b ("netfilter: x_tables: never register tables by
> > default") on linux-next
> > introduces the function xt_register_template() and in all cases but
> > one, the calls to that function are followed by:
> >
> > if (ret < 0)
> > return ret;
> >
> > All these checks were also added with the commit above.
> >
> > In the one case, for iptable_mangle_init() in
> > ./net/ipv4/netfilter/iptable_mangle.c, this pattern was not followed.
>
> Thats a bug, the error test is missing.
I send out a patch addressing the issue, please pick it:
https://lore.kernel.org/lkml/20210823202729.2009-1-lukas.bulwahn@gmail.com/
Thanks,
Lukas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-23 20:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 17:01 Suspicious pattern for use of function xt_register_template() Lukas Bulwahn
2021-08-23 19:10 ` Florian Westphal
2021-08-23 20:28 ` Lukas Bulwahn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).