[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220222065746.GA14401@breakpoint.cc>
Date: Tue, 22 Feb 2022 07:57:46 +0100
From: Florian Westphal <fw@...len.de>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Pablo Neira Ayuso <pablo@...filter.org>,
netfilter-devel@...r.kernel.org, davem@...emloft.net,
netdev@...r.kernel.org, Florian Westphal <fw@...len.de>
Subject: Re: [PATCH nf 5/5] netfilter: nf_tables: fix memory leak during
stateful obj update
Jakub Kicinski <kuba@...nel.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.
Powered by blists - more mailing lists