From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8809920893552987355==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] mlxsw: core_linecards: fix badty.cocci warnings Date: Mon, 14 Mar 2022 05:06:56 +0800 Message-ID: <20220313210656.GA49256@4ad7b4e07a36> In-Reply-To: <202203140550.Jh4DuTyQ-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8809920893552987355== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Jiri Pirko CC: Ido Schimmel From: kernel test robot drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:819:18-48: WARNING: Us= e correct pointer type argument for sizeof Correct the size argument to alloc functions Semantic patch information: This makes an effort to find cases where the argument to sizeof is wrong in memory allocation functions by checking the type of the allocated memory when it is a double pointer and ensuring the sizeof argument takes a point= er to the the memory being allocated. There are false positives in cases the sizeof argument is not used in constructing the return value. The result may need some reformatting. Generated by: scripts/coccinelle/misc/badty.cocci Fixes: 4d458d15b45f ("mlxsw: core_linecards: Add line card objects and impl= ement provisioning") CC: Jiri Pirko Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/jpirko/linux_mlxsw combined_queue head: a0b1c3a5cea0369e9eeb4307b520ced5440f7b13 commit: 4d458d15b45f6a4fa8d89e0319d4bc3352bd33a0 [33/79] mlxsw: core_lineca= rds: Add line card objects and implement provisioning :::::: branch date: 3 hours ago :::::: commit date: 10 hours ago Please take the patch only if it's a positive warning. Thanks! drivers/net/ethernet/mellanox/mlxsw/core_linecards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_linecards.c @@ -816,7 +816,7 @@ static int mlxsw_linecard_types_init(str } = types_info->ini_files =3D kmalloc_array(types_info->count, - sizeof(struct mlxsw_linecard_ini_file), + sizeof(*types_info->ini_files), GFP_KERNEL); if (!types_info->ini_files) { err =3D -ENOMEM; --===============8809920893552987355==--