From: Bhanu Seshu Kumar Valluri <bhanuseshukumar@gmail.com>
To: epomozov@marvell.com, irusskikh@marvell.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com,
bhanuseshukumar@gmail.com
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
skhan@linuxfoundation.org, david.hunter.linux@gmail.com
Subject: [PATCH] net: atlantic: Use kmalloc_array to prevent overflow of dynamic size calculation
Date: Tue, 30 Sep 2025 16:49:33 +0530 [thread overview]
Message-ID: <20250930111933.28730-1-bhanuseshukumar@gmail.com> (raw)
Use kmalloc_array to avoid potential overflow during dynamic size calculation
inside kmalloc.
Signed-off-by: Bhanu Seshu Kumar Valluri <bhanuseshukumar@gmail.com>
---
Note: Patch is tested for compilation.
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
index 5acb3e16b567..f445d449f80f 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
@@ -182,7 +182,7 @@ static unsigned int aq_ptp_skb_buf_len(struct ptp_skb_ring *ring)
static int aq_ptp_skb_ring_init(struct ptp_skb_ring *ring, unsigned int size)
{
- struct sk_buff **buff = kmalloc(sizeof(*buff) * size, GFP_KERNEL);
+ struct sk_buff **buff = kmalloc_array(sizeof(*buff), size, GFP_KERNEL);
if (!buff)
return -ENOMEM;
--
2.34.1
next reply other threads:[~2025-09-30 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 11:19 Bhanu Seshu Kumar Valluri [this message]
2025-09-30 11:24 ` [PATCH] net: atlantic: Use kmalloc_array to prevent overflow of dynamic size calculation Sahil Chandna
2025-09-30 11:37 ` bhanuseshukumar
2025-09-30 12:17 ` Eric Dumazet
2025-09-30 13:12 ` Bhanu Seshu Kumar Valluri
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=20250930111933.28730-1-bhanuseshukumar@gmail.com \
--to=bhanuseshukumar@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=david.hunter.linux@gmail.com \
--cc=edumazet@google.com \
--cc=epomozov@marvell.com \
--cc=irusskikh@marvell.com \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=skhan@linuxfoundation.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.