From: Florian Westphal <fw@strlen.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH nf 5/5] netfilter: nf_tables: fix memory leak during stateful obj update
Date: Tue, 22 Feb 2022 07:57:46 +0100 [thread overview]
Message-ID: <20220222065746.GA14401@breakpoint.cc> (raw)
In-Reply-To: <20220221205840.08110cab@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Jakub Kicinski <kuba@kernel.org> wrote:
> > static void nft_commit_release(struct nft_trans *trans)
> > @@ -8976,7 +8981,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
> > break;
> > case NFT_MSG_NEWOBJ:
> > if (nft_trans_obj_update(trans)) {
> > - kfree(nft_trans_obj_newobj(trans));
> > + nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans));
> > nft_trans_destroy(trans);
> > } else {
> > trans->ctx.table->use--;
>
> net/netfilter/nf_tables_api.c:6561:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
> if (!trans)
> ^~~~~~
> net/netfilter/nf_tables_api.c:6581:9: note: uninitialized use occurs here
> return err;
> ^~~
> net/netfilter/nf_tables_api.c:6561:2: note: remove the 'if' if its condition is always false
> if (!trans)
> ^~~~~~~~~~~
> net/netfilter/nf_tables_api.c:6554:9: note: initialize the variable 'err' to silence this warning
> int err;
> ^
I've sent a followup patch to this, no idea why gcc doesn't warn here.
Looks like I should dump it in favor of clang.
prev parent reply other threads:[~2022-02-22 6:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 16:17 [PATCH nf 0/5] Netfilter fixes for net Pablo Neira Ayuso
2022-02-21 16:17 ` [PATCH nf 1/5] netfilter: xt_socket: missing ifdef CONFIG_IP6_NF_IPTABLES dependency Pablo Neira Ayuso
2022-02-21 16:17 ` [PATCH nf 2/5] netfilter: nf_tables_offload: incorrect flow offload action array size Pablo Neira Ayuso
2022-02-21 22:24 ` Dominique Martinet
2022-02-21 16:17 ` [PATCH nf 3/5] netfilter: nf_tables: unregister flowtable hooks on netns exit Pablo Neira Ayuso
2022-02-21 16:17 ` [PATCH nf 4/5] netfilter: nft_limit: fix stateful object memory leak Pablo Neira Ayuso
2022-02-21 16:17 ` [PATCH nf 5/5] netfilter: nf_tables: fix memory leak during stateful obj update Pablo Neira Ayuso
2022-02-22 4:58 ` Jakub Kicinski
2022-02-22 6:57 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220222065746.GA14401@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).