From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1367693365970373000==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] mlxsw: core_linecards: fix badty.cocci warnings Date: Wed, 20 Apr 2022 06:03:12 +0800 Message-ID: In-Reply-To: <202204200641.UExpaKGA-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============1367693365970373000== 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 Memory Management List TO: Jiri Pirko CC: Ido Schimmel CC: Petr Machata CC: Jakub Kicinski CC: Paolo Abeni CC: netdev(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:826: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: b217127e5e4e ("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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git= master head: 634de1db0e9bbeb90d7b01020e59ec3dab4d38a1 commit: b217127e5e4ee0ecfce7c5f84cfe082238123bda [4374/4662] mlxsw: core_li= necards: Add line card objects and implement provisioning :::::: branch date: 15 hours ago :::::: commit date: 2 days 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 @@ -823,7 +823,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; --===============1367693365970373000==--