* [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure
@ 2022-08-26 15:03 Dan Carpenter
2022-08-26 16:02 ` Petr Machata
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-08-26 15:03 UTC (permalink / raw)
To: Ido Schimmel, Vadim Pasternak
Cc: Petr Machata, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Jiri Pirko, netdev, kernel-janitors
These error paths return success but they should return -ENOMEM.
Fixes: 01328e23a476 ("mlxsw: minimal: Extend module to port mapping with slot index")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
index 7d3fa2883e8b..c7f7e49251f4 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
@@ -404,8 +404,10 @@ static int mlxsw_m_linecards_init(struct mlxsw_m *mlxsw_m)
mlxsw_m->line_cards = kcalloc(mlxsw_m->num_of_slots,
sizeof(*mlxsw_m->line_cards),
GFP_KERNEL);
- if (!mlxsw_m->line_cards)
+ if (!mlxsw_m->line_cards) {
+ err = -ENOMEM;
goto err_kcalloc;
+ }
for (i = 0; i < mlxsw_m->num_of_slots; i++) {
mlxsw_m->line_cards[i] =
@@ -413,8 +415,10 @@ static int mlxsw_m_linecards_init(struct mlxsw_m *mlxsw_m)
module_to_port,
mlxsw_m->max_modules_per_slot),
GFP_KERNEL);
- if (!mlxsw_m->line_cards[i])
+ if (!mlxsw_m->line_cards[i]) {
+ err = -ENOMEM;
goto err_kmalloc_array;
+ }
/* Invalidate the entries of module to local port mapping array. */
for (j = 0; j < mlxsw_m->max_modules_per_slot; j++)
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure
2022-08-26 15:03 [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure Dan Carpenter
@ 2022-08-26 16:02 ` Petr Machata
2022-08-27 13:19 ` Ido Schimmel
2022-08-31 6:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2022-08-26 16:02 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ido Schimmel, Vadim Pasternak, Petr Machata, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jiri Pirko, netdev,
kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> writes:
> These error paths return success but they should return -ENOMEM.
>
> Fixes: 01328e23a476 ("mlxsw: minimal: Extend module to port mapping with slot index")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure
2022-08-26 15:03 [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure Dan Carpenter
2022-08-26 16:02 ` Petr Machata
@ 2022-08-27 13:19 ` Ido Schimmel
2022-08-31 6:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-08-27 13:19 UTC (permalink / raw)
To: Dan Carpenter
Cc: Vadim Pasternak, Petr Machata, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Jiri Pirko, netdev, kernel-janitors
On Fri, Aug 26, 2022 at 06:03:30PM +0300, Dan Carpenter wrote:
> These error paths return success but they should return -ENOMEM.
>
> Fixes: 01328e23a476 ("mlxsw: minimal: Extend module to port mapping with slot index")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure
2022-08-26 15:03 [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure Dan Carpenter
2022-08-26 16:02 ` Petr Machata
2022-08-27 13:19 ` Ido Schimmel
@ 2022-08-31 6:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-31 6:30 UTC (permalink / raw)
To: Dan Carpenter
Cc: idosch, vadimp, petrm, davem, edumazet, kuba, pabeni, jiri,
netdev, kernel-janitors
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 26 Aug 2022 18:03:30 +0300 you wrote:
> These error paths return success but they should return -ENOMEM.
>
> Fixes: 01328e23a476 ("mlxsw: minimal: Extend module to port mapping with slot index")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/minimal.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Here is the summary with links:
- [net-next] mlxsw: minimal: Return -ENOMEM on allocation failure
https://git.kernel.org/netdev/net-next/c/57688eb887af
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] 4+ messages in thread
end of thread, other threads:[~2022-08-31 6:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 15:03 [PATCH net-next] mlxsw: minimal: Return -ENOMEM on allocation failure Dan Carpenter
2022-08-26 16:02 ` Petr Machata
2022-08-27 13:19 ` Ido Schimmel
2022-08-31 6:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.