Skip to content

Commit 23c6859

Browse files
andy-shevgregkh
authored andcommitted
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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d69d804 commit 23c6859

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ int platform_device_add_resources(struct platform_device *pdev,
608608
struct resource *r = NULL;
609609

610610
if (res) {
611-
r = kmemdup(res, sizeof(struct resource) * num, GFP_KERNEL);
611+
r = kmemdup_array(res, num, sizeof(*r), GFP_KERNEL);
612612
if (!r)
613613
return -ENOMEM;
614614
}

0 commit comments

Comments
 (0)