media: staging: ipu3: use vcalloc() instead of vzalloc() with multiply
Subsystems (3)
PATCH 1/1 media: staging: ipu3: use vcalloc() instead of vzalloc() with multiply
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 <[email protected]>
--- drivers/staging/media/ipu3/ipu3-mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu3/ipu3-mmu.c +1 -1
@@ -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;