Skip to content

Commit

Permalink
mlxsw: core_linecards: Fix size of array element during ini_files all…
Browse files Browse the repository at this point in the history
…ocation

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: b217127 ("mlxsw: core_linecards: Add line card objects and implement provisioning")
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20220420142007.3041173-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jiri Pirko authored and Jakub Kicinski committed Apr 22, 2022
1 parent 5e72607 commit 869376d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlxsw/core_linecards.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 869376d

Please sign in to comment.