linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ARM: omap2: Switch to use kmemdup_array()
@ 2024-06-06 16:51 Andy Shevchenko
  2024-06-06 19:32 ` Aaro Koskinen
  2024-07-09  0:13 ` Kevin Hilman
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-06-06 16:51 UTC (permalink / raw)
  To: Andy Shevchenko, linux-arm-kernel, linux-omap, linux-kernel
  Cc: Tony Lindgren, Russell King

Let the kememdup_array() take care about multiplication and possible
overflows.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/arm/mach-omap2/omap_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-09  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 16:51 [PATCH v1 1/1] ARM: omap2: Switch to use kmemdup_array() Andy Shevchenko
2024-06-06 19:32 ` Aaro Koskinen
2024-06-06 19:43   ` Andy Shevchenko
2024-06-06 19:47     ` Aaro Koskinen
2024-07-09  0:13 ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).