aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2024-06-06 16:49:26 +0000
committerGreg Kroah-Hartman <[email protected]>2024-07-04 10:02:38 +0000
commit23c6859677066fa3d6bb3672703636dd673cb5dd (patch)
treef522104072b2c15862074e577b3e2db15bba510e /drivers/base/platform.c
parentdriver core: have match() callback in struct bus_type take a const * (diff)
downloadkernel-23c6859677066fa3d6bb3672703636dd673cb5dd.tar.gz
kernel-23c6859677066fa3d6bb3672703636dd673cb5dd.zip
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]>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 8a511fe47bdb..4c3ee6521ba5 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -608,7 +608,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;
}