All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] mlxsw: core_linecards: fix badty.cocci warnings
Date: Wed, 20 Apr 2022 06:03:12 +0800	[thread overview]
Message-ID: <Yl8xoN3N1UxohvLb@00a3b03d768d> (raw)
In-Reply-To: <202204200641.UExpaKGA-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Jiri Pirko <jiri@nvidia.com>
CC: Ido Schimmel <idosch@nvidia.com>
CC: Petr Machata <petrm@nvidia.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Paolo Abeni <pabeni@redhat.com>
CC: netdev(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:826:18-48: WARNING: Use 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 pointer
 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 implement provisioning")
CC: Jiri Pirko <jiri@nvidia.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   634de1db0e9bbeb90d7b01020e59ec3dab4d38a1
commit: b217127e5e4ee0ecfce7c5f84cfe082238123bda [4374/4662] mlxsw: core_linecards: 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 = kmalloc_array(types_info->count,
-					      sizeof(struct mlxsw_linecard_ini_file),
+					      sizeof(*types_info->ini_files),
 					      GFP_KERNEL);
 	if (!types_info->ini_files) {
 		err = -ENOMEM;

  reply	other threads:[~2022-04-19 22:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 22:08 [linux-next:master 4374/4662] drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:826:18-48: WARNING: Use correct pointer type argument for sizeof kernel test robot
2022-04-19 22:03 ` kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-13 21:13 [jpirko-mlxsw:combined_queue 33/79] drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:819:18-48: " kernel test robot
2022-03-13 21:06 ` [PATCH] mlxsw: core_linecards: fix badty.cocci warnings kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yl8xoN3N1UxohvLb@00a3b03d768d \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.