[PATCH nf] netfilter: nf_tables: make sure err is initialised to sane value

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

 



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@xxxxxxxxx>
Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 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(-)

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;
-- 
2.34.1




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

  Powered by Linux