From: Jiri Pirko Date: Wed, 20 Apr 2022 14:20:07 +0000 (+0300) Subject: mlxsw: core_linecards: Fix size of array element during ini_files allocation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=869376d0859acf40c83b2c3942ad9d5a8b5d31e4;p=linux.git mlxsw: core_linecards: Fix size of array element during ini_files allocation 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") Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel Link: https://lore.kernel.org/r/20220420142007.3041173-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c index 90e487cc2e2a5..5c9869dcf674a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c @@ -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;