[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230406063120.3626731-1-harshit.m.mogalapalli@oracle.com>
Date: Wed, 5 Apr 2023 23:31:18 -0700
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: error27@...il.com, kernel-janitors@...r.kernel.org,
Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Leon Romanovsky <leon@...nel.org>,
Kees Cook <keescook@...omium.org>,
Rob Herring <robh@...nel.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels()
Smatch reports: drivers/net/ethernet/sun/niu.c:4525
niu_alloc_channels() warn: missing unwind goto?
If niu_rbr_fill() fails, then we are directly returning 'err' without
freeing the channels.
Fix this by changing direct return to a goto 'out_err'.
Fixes: a3138df9f20e ("[NIU]: Add Sun Neptune ethernet driver.")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
---
This is purely based on static analysis. Only compile tested.
---
drivers/net/ethernet/sun/niu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index ab8b09a9ef61..7a2e76776297 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -4522,7 +4522,7 @@ static int niu_alloc_channels(struct niu *np)
err = niu_rbr_fill(np, rp, GFP_KERNEL);
if (err)
- return err;
+ goto out_err;
}
tx_rings = kcalloc(num_tx_rings, sizeof(struct tx_ring_info),
--
2.38.1
Powered by blists - more mailing lists