[PATCH v2 1/3] staging: media: atomisp: use kvmalloc_objs() in make_histogram()

From: Rodrigo Gobbi

Date: Mon Jun 22 2026 - 18:44:57 EST


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@xxxxxxxxx>
---
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