From: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
To: andy@kernel.org, hansg@kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org
Cc: ~lkcamp/patches@lists.sr.ht,
linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: [PATCH v2 1/3] staging: media: atomisp: use kvmalloc_objs() in make_histogram()
Date: Mon, 22 Jun 2026 19:42:42 -0300 [thread overview]
Message-ID: <20260622224402.34001-2-rodrigo.gobbi.7@gmail.com> (raw)
In-Reply-To: <20260622224402.34001-1-rodrigo.gobbi.7@gmail.com>
Replace kvmalloc() with multiply with kvmalloc_objs(), which handles
the size multiplication internally with overflow checking, silenting
checkpatch warn.
Signed-off-by: Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>
---
drivers/staging/media/atomisp/pci/sh_css_metrics.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/sh_css_metrics.c b/drivers/staging/media/atomisp/pci/sh_css_metrics.c
index edf473dd86ca..90d92ab8d52b 100644
--- a/drivers/staging/media/atomisp/pci/sh_css_metrics.c
+++ b/drivers/staging/media/atomisp/pci/sh_css_metrics.c
@@ -4,6 +4,8 @@
* Copyright (c) 2015, Intel Corporation.
*/
+#include <linux/slab.h>
+
#include "assert_support.h"
#include "sh_css_metrics.h"
@@ -59,16 +61,13 @@ make_histogram(struct sh_css_pc_histogram *histogram, unsigned int length)
return;
if (histogram->run)
return;
- histogram->run = kvmalloc(length * sizeof(*histogram->run),
- GFP_KERNEL);
+ histogram->run = kvmalloc_objs(*histogram->run, length);
if (!histogram->run)
return;
- histogram->stall = kvmalloc(length * sizeof(*histogram->stall),
- GFP_KERNEL);
+ histogram->stall = kvmalloc_objs(*histogram->stall, length);
if (!histogram->stall)
return;
- histogram->msink = kvmalloc(length * sizeof(*histogram->msink),
- GFP_KERNEL);
+ histogram->msink = kvmalloc_objs(*histogram->msink, length);
if (!histogram->msink)
return;
--
2.48.1
next prev parent reply other threads:[~2026-06-22 22:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 22:42 [PATCH v2 0/3] staging: media: atomisp: use kvmalloc_objs() and drop redundant OOM messages Rodrigo Gobbi
2026-06-22 22:42 ` Rodrigo Gobbi [this message]
2026-06-22 22:42 ` [PATCH v2 2/3] staging: media: atomisp: use kvmalloc_objs() for overflow-safe allocation Rodrigo Gobbi
2026-06-23 10:22 ` Andy Shevchenko
2026-06-22 22:42 ` [PATCH v2 3/3] staging: media: atomisp: drop redundant out-of-memory messages Rodrigo Gobbi
2026-06-23 9:29 ` [PATCH v2 0/3] staging: media: atomisp: use kvmalloc_objs() and drop redundant OOM messages Andy Shevchenko
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=20260622224402.34001-2-rodrigo.gobbi.7@gmail.com \
--to=rodrigo.gobbi.7@gmail.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--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 \
--cc=~lkcamp/patches@lists.sr.ht \
/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