From: Andrew Soto <linux@notrealandy.dev>
To: linux@notrealandy.dev
Cc: andy@kernel.org, gregkh@linuxfoundation.org, hansg@kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, mchehab@kernel.org,
sakari.ailus@linux.intel.com
Subject: [PATCH v2] staging: media: atomisp: prefer kcalloc over kzalloc with multiply
Date: Sun, 7 Jun 2026 12:18:33 +0000 [thread overview]
Message-ID: <20260607121833.10058-1-linux@notrealandy.dev> (raw)
In-Reply-To: <20260606234427.9902-1-linux@notrealandy.dev>
Optimize memory allocation layout in sh_css_params.c by replacing
the raw multiplication inside kzalloc() with a type-safe kcalloc()
array allocation wrapper.
This prevents potential integer overflow vulnerabilities by validating
the array size calculations before interacting
with the kernel heap allocator, aligning the driver with modern kernel
memory allocation standards.
Signed-off-by: Andrew Soto <linux@notrealandy.dev>
---
drivers/staging/media/atomisp/pci/sh_css_params.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
index fcebace11..9147ca047 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_params.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
@@ -3716,7 +3716,7 @@ ia_css_ptr sh_css_store_sp_group_to_ddr(void)
IA_CSS_ENTER_LEAVE_PRIVATE("void");
- write_buf = kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+ write_buf = kcalloc(8192, sizeof(u8), GFP_KERNEL);
if (!write_buf)
return 0;
--
2.53.0
prev parent reply other threads:[~2026-06-07 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-06 23:44 [PATCH] staging: media: atomisp: prefer kcalloc over kzalloc with multiply Andrew Soto
2026-06-07 7:42 ` Andy Shevchenko
2026-06-07 12:18 ` Andrew Soto [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=20260607121833.10058-1-linux@notrealandy.dev \
--to=linux@notrealandy.dev \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.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