Skip to contentSkip to conversation

mlxsw: core_linecards: Fix size of array element during ini_files allocation

PATCH Applied Ido Schimmel 2 participants 2 messages Apr 20, 2022 – Apr 22, 2022

Subsystems (3)
lore
Share & tools
lore

Ido Schimmel

author maintainer
#0 lore raw

PATCH 1/1 mlxsw: core_linecards: Fix size of array element during ini_files allocation

From: Jiri Pirko <[email protected]>

types_info->ini_files is an array of pointers
to struct mlxsw_linecard_ini_file.

Fix the kmalloc_array() argument to be of a size of a pointer.

Addresses-Coverity: ("Incorrect expression (SIZEOF_MISMATCH)")

Fixes b217127e5e4e ("mlxsw: core_linecards: Add line card objects and implement provisioning")
---
 drivers/net/ethernet/mellanox/mlxsw/core_linecards.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +1 -1
index 90e487cc2e2a..5c9869dcf674 100644
@@ -1032,7 +1032,7 @@ static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core,
 	}
 
 	types_info->ini_files = kmalloc_array(types_info->count,
-					      sizeof(struct mlxsw_linecard_ini_file),
+					      sizeof(struct mlxsw_linecard_ini_file *),
 					      GFP_KERNEL);
 	if (!types_info->ini_files) {
 		err = -ENOMEM;
Signature · 1 line
2.33.1
#1 lore raw
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 8 lines · On Wed, 20 Apr 2022 17:20:07 +0300 you wrote:

From: Jiri Pirko <[email protected]>

types_info->ini_files is an array of pointers
to struct mlxsw_linecard_ini_file.

Fix the kmalloc_array() argument to be of a size of a pointer.

[...]

Here is the summary with links:
- [net-next] mlxsw: core_linecards: Fix size of array element during ini_files allocation

    https://git.kernel.org/netdev/net-next/c/869376d0859a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html