Message ID | 20220221210423.28805-1-fw@strlen.de |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | [nf] netfilter: nf_tables: make sure err is initialised to sane value | expand |
On Mon, Feb 21, 2022 at 10:04:23PM +0100, Florian Westphal wrote: > All warnings (new ones prefixed by >>): > > net/netfilter/nf_tables_api.c:6561:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true I have collapsed this to the original patch, thanks!
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 49060f281342..9cd1d7a62804 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6551,7 +6551,7 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, { struct nft_object *newobj; struct nft_trans *trans; - int err; + int err = -ENOMEM; if (!try_module_get(type->owner)) return -ENOENT;
All warnings (new ones prefixed by >>): net/netfilter/nf_tables_api.c:6561:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true Fixes: 33170d18fd2c ("netfilter: nf_tables: fix memory leak during stateful obj update") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Florian Westphal <fw@strlen.de> --- For some reason gcc 11.2 doesn't emit such a warning. net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)