* [PATCH v1 1/1] driver core: platform: Switch to use kmemdup_array()
@ 2024-06-06 16:49 Andy Shevchenko
0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2024-06-06 16:49 UTC (permalink / raw)
To: Andy Shevchenko, linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki
Let the kememdup_array() take care about multiplication and possible
overflows.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index de89d8ca7cec..0ac3c7fa7f94 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -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;
}
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-06-06 16:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-06 16:49 [PATCH v1 1/1] driver core: platform: Switch to use kmemdup_array() Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®