* [PATCH] niu: Fix missing unwind goto in niu_alloc_channels()
@ 2023-04-06 6:31 Harshit Mogalapalli
2023-04-06 14:30 ` Simon Horman
2023-04-07 7:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Harshit Mogalapalli @ 2023-04-06 6:31 UTC (permalink / raw)
Cc: error27, kernel-janitors, Harshit Mogalapalli, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Marc Kleine-Budde,
Leon Romanovsky, Kees Cook, Rob Herring, Wolfram Sang, netdev,
linux-kernel
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@oracle.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels()
2023-04-06 6:31 [PATCH] niu: Fix missing unwind goto in niu_alloc_channels() Harshit Mogalapalli
@ 2023-04-06 14:30 ` Simon Horman
2023-04-07 7:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-04-06 14:30 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: error27, kernel-janitors, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Marc Kleine-Budde, Leon Romanovsky,
Kees Cook, Rob Herring, Wolfram Sang, netdev, linux-kernel
On Wed, Apr 05, 2023 at 11:31:18PM -0700, Harshit Mogalapalli wrote:
> 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@oracle.com>
> ---
> This is purely based on static analysis. Only compile tested.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels()
2023-04-06 6:31 [PATCH] niu: Fix missing unwind goto in niu_alloc_channels() Harshit Mogalapalli
2023-04-06 14:30 ` Simon Horman
@ 2023-04-07 7:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-04-07 7:20 UTC (permalink / raw)
To: Harshit Mogalapalli
Cc: error27, kernel-janitors, davem, edumazet, kuba, pabeni, mkl,
leon, keescook, robh, wsa+renesas, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 5 Apr 2023 23:31:18 -0700 you wrote:
> 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'.
>
> [...]
Here is the summary with links:
- niu: Fix missing unwind goto in niu_alloc_channels()
https://git.kernel.org/netdev/net/c/8ce07be70345
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-07 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06 6:31 [PATCH] niu: Fix missing unwind goto in niu_alloc_channels() Harshit Mogalapalli
2023-04-06 14:30 ` Simon Horman
2023-04-07 7:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox