From: Weimin Xiong <xiongwm2026@163.com>
To: intel-wired-lan@lists.osuosl.org
Cc: aleksander.lobakin@intel.com, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Subject: [PATCH v2] ice: parser: use kcalloc for table allocation
Date: Tue, 21 Jul 2026 09:57:47 +0800 (CST) [thread overview]
Message-ID: <6A5ED21A.2B234A.06153@m16.mail.163.com> (raw)
In-Reply-To: <28460003-47ee-4706-ad95-7fba87d36509@intel.com>
From 376dfdfc788a853c79a87c4bfdd94dc1ea678c43 Mon Sep 17 00:00:00 2001
From: Weimin Xiong <xiongwm2026@163.com>
Date: Tue, 21 Jul 2026 09:46:46 +0800
Subject: [PATCH v2] ice: parser: use kcalloc for table allocation
To: intel-wired-lan@lists.osuosl.org
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
In-Reply-To: <28460003-47ee-4706-ad95-7fba87d36509@intel.com>
References: <20260716025100.118145-1-xiongwm2026@163.com>
Use kcalloc() when calculating the parser table allocation size so an
overflow in the firmware-provided item dimensions is detected before
allocation.
v2: Use kcalloc() instead of kzalloc(array_size()) as suggested by
Alexander Lobakin <aleksander.lobakin@intel.com>
---
v1->v2:
- Remove redundant include of <linux/overflow.h>
- Use kcalloc() instead of kzalloc(array_size()) as suggested by
Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Weimin Xiong <xiongwm2026@163.com>
---
drivers/net/ethernet/intel/ice/ice_parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c
index f8e69630f..f5ae6c071 100644
--- a/drivers/net/ethernet/intel/ice/ice_parser.c
+++ b/drivers/net/ethernet/intel/ice/ice_parser.c
@@ -102,7 +102,7 @@ ice_parser_create_table(struct ice_hw *hw, u32 sect_type,
if (!seg)
return ERR_PTR(-EINVAL);
- table = kzalloc(item_size * length, GFP_KERNEL);
+ table = kcalloc(length, item_size, GFP_KERNEL);
if (!table)
return ERR_PTR(-ENOMEM);
base-commit: 95e24e90b55ce6d9d266ed6f20514f37c931c751
--
2.43.0
prev parent reply other threads:[~2026-07-21 1:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 2:51 [PATCH] ice: parser: use array_size() for table allocation Weimin Xiong
2026-07-20 15:05 ` [Intel-wired-lan] " Alexander Lobakin
2026-07-21 1:57 ` Weimin Xiong [this message]
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=6A5ED21A.2B234A.06153@m16.mail.163.com \
--to=xiongwm2026@163.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox