Re: [PATCH nf 5/5] netfilter: nf_tables: fix memory leak during stateful obj update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Kicinski <kuba@xxxxxxxxxx> 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.



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux