Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: staging: ipu3: use vcalloc() instead of vzalloc() with multiply
@ 2026-09-01  7:46 Hrushiraj Gandhi
  0 siblings, 0 replies; only message in thread
From: Hrushiraj Gandhi @ 2026-09-01  7:46 UTC (permalink / raw)
  To: sakari.ailus, mchehab, gregkh
  Cc: linux-media, linux-staging, linux-kernel, Hrushiraj Gandhi

mmu->l2pts is sized as IPU3_PT_PTES * sizeof(*mmu->l2pts) by hand.
Use vcalloc() instead, which computes the size via the overflow-checked
size_mul() so a large enough count fails the allocation cleanly
instead of silently wrapping size_t into a too-small buffer.

No functional change.

Signed-off-by: Hrushiraj Gandhi <hrushirajg23@gmail.com>
---
 drivers/staging/media/ipu3/ipu3-mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/ipu3/ipu3-mmu.c b/drivers/staging/media/ipu3/ipu3-mmu.c
index b196a5815903..ab40502c06b8 100644
--- a/drivers/staging/media/ipu3/ipu3-mmu.c
+++ b/drivers/staging/media/ipu3/ipu3-mmu.c
@@ -464,7 +464,7 @@ struct imgu_mmu_info *imgu_mmu_init(struct device *parent, void __iomem *base)
 	 * Allocate the array of L2PT CPU pointers, initialized to zero,
 	 * which means the dummy L2PT allocated above.
 	 */
-	mmu->l2pts = vzalloc(IPU3_PT_PTES * sizeof(*mmu->l2pts));
+	mmu->l2pts = vcalloc(IPU3_PT_PTES, sizeof(*mmu->l2pts));
 	if (!mmu->l2pts)
 		goto fail_l2pt;
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-01  7:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01  7:46 [PATCH] media: staging: ipu3: use vcalloc() instead of vzalloc() with multiply Hrushiraj Gandhi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox