mlxsw: minimal: Return -ENOMEM on allocation failure
PATCH 1/1 mlxsw: minimal: Return -ENOMEM on allocation failure
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 <[email protected]>
--- drivers/net/ethernet/mellanox/mlxsw/minimal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/minimal.c +6 -2
@@ -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++)
Signature · 1 line
2.35.1
Quoted 4 lines · Dan Carpenter
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 <[email protected]>
Reviewed-by Petr Machata <[email protected]>
Thanks!
Quoted 4 lines · Dan Carpenter
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 <[email protected]>
Reviewed-by Ido Schimmel <[email protected]>
Thanks!
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 7 lines · 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 <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html