From: Andy Shevchenko Date: Thu, 6 Jun 2024 16:51:04 +0000 (+0300) Subject: ARM: omap2: Switch to use kmemdup_array() X-Git-Tag: v6.12-rc1~185^2~5^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=fcd5b7401dc4b25880e46769975c85091a3c2946;p=linux-block.git ARM: omap2: Switch to use kmemdup_array() Let the kmemdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko Reviewed-by: Aaro Koskinen Link: https://lore.kernel.org/r/20240606165104.3031737-1-andriy.shevchenko@linux.intel.com Signed-off-by: Kevin Hilman --- diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index fca7869c8075..800980057373 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -315,7 +315,7 @@ static struct omap_device *omap_device_alloc(struct platform_device *pdev, od->hwmods_cnt = oh_cnt; - hwmods = kmemdup(ohs, sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL); + hwmods = kmemdup_array(ohs, oh_cnt, sizeof(*hwmods), GFP_KERNEL); if (!hwmods) goto oda_exit2;