driver core: platform: Switch to use kmemdup_array()
PATCH 1/1 driver core: platform: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/base/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/platform.c +1 -1
@@ -643,7 +643,7 @@ int platform_device_add_resources(struct platform_device *pdev,struct resource *r =NULL ;if (res) { - r =kmemdup (res,sizeof (struct resource ) * num,GFP_KERNEL ); + r =kmemdup_array (res, num,sizeof (*r),GFP_KERNEL );if (!r)return -ENOMEM ; }
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac