From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] mlxsw: core_linecards: fix badty.cocci warnings
Date: Mon, 14 Mar 2022 05:06:56 +0800 [thread overview]
Message-ID: <20220313210656.GA49256@4ad7b4e07a36> (raw)
In-Reply-To: <202203140550.Jh4DuTyQ-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Jiri Pirko <jiri@nvidia.com>
CC: Ido Schimmel <idosch@nvidia.com>
From: kernel test robot <lkp@intel.com>
drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:819: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: 4d458d15b45f ("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://github.com/jpirko/linux_mlxsw combined_queue
head: a0b1c3a5cea0369e9eeb4307b520ced5440f7b13
commit: 4d458d15b45f6a4fa8d89e0319d4bc3352bd33a0 [33/79] mlxsw: core_linecards: 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 = 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;
next prev parent reply other threads:[~2022-03-13 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-13 21:13 [jpirko-mlxsw:combined_queue 33/79] drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:819:18-48: WARNING: Use correct pointer type argument for sizeof kernel test robot
2022-03-13 21:06 ` kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-04-19 22:08 [linux-next:master 4374/4662] drivers/net/ethernet/mellanox/mlxsw/core_linecards.c:826:18-48: " kernel test robot
2022-04-19 22:03 ` [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=20220313210656.GA49256@4ad7b4e07a36 \
--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.