ARM: omap2: Switch to use kmemdup_array()
Subsystems (3)
PATCH 1/1 ARM: omap2: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows.
--- arch/arm/mach-omap2/omap_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/omap_device.c +1 -1
@@ -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;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Aaro Koskinen
maintainerHi,
Quoted 1 line · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible
^^^^^
Typo.Quoted 12 lines
overflows.
Signed-off-by Andy Shevchenko <[email protected]>--- arch/arm/mach-omap2/omap_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-omap2/omap_device.c +0
-0
arch/arm/mach-omap2/omap_device.c static struct omap_device *omap_device_alloc(struct platform_device *pdev, · line 318
Quoted 5 lines
arch/arm/mach-omap2/omap_device.c +1
-1@@ -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 );
Maybe same result, but I guess the 3rd parameter should be count?
A.
Quoted 5 lines · Aaro Koskinen
Quoted 1 line · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible^^^^^ Typo.
Aha, thanks!
Quoted 1 line
Quoted 1 line
overflows.
...
Quoted 4 lines
arch/arm/mach-omap2/omap_device.c static struct omap_device *omap_device_alloc(struct platform_device *pdev, · line 318
Quoted 2 lines
arch/arm/mach-omap2/omap_device.c +1
-1- hwmods =kmemdup (ohs,sizeof (struct omap_hwmod *) * oh_cnt,GFP_KERNEL ); + hwmods =kmemdup_array (ohs, oh_cnt,sizeof (*hwmods),GFP_KERNEL );Maybe same result, but I guess the 3rd parameter should be count?
Actually it is going to be changed to follow kcalloc().
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=0ee14725471c
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 5 lines · Aaro Koskinen
Quoted 1 line · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible^^^^^ Typo.Aha, thanks!
Quoted 1 line
Quoted 1 line
overflows.
...
Quoted 7 lines
Quoted 4 lines
arch/arm/mach-omap2/omap_device.c static struct omap_device *omap_device_alloc(struct platform_device *pdev, · line 318
Quoted 2 lines
arch/arm/mach-omap2/omap_device.c +1
-1- hwmods =kmemdup (ohs,sizeof (struct omap_hwmod *) * oh_cnt,GFP_KERNEL ); + hwmods =kmemdup_array (ohs, oh_cnt,sizeof (*hwmods),GFP_KERNEL );Maybe same result, but I guess the 3rd parameter should be count?
Actually it is going to be changed to follow
kcalloc().
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=0ee14725471c
OK, good, you can add:
A.
Quoted 4 lines · Andy Shevchenko
Let the
kememdup_array()take care about multiplication and possible overflows.
Applied, thanks!
[1/1] ARM: omap2: Switch to use kmemdup_array()
commit: ea77ad3d2dccaf223c556886b067c5e2657b40aa
Best regards,
Signature · 1 line
Kevin Hilman <[email protected]>