Commit 23c68596 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman
Browse files

driver core: platform: Switch to use kmemdup_array()



Let the kememdup_array() take care about multiplication and possible
overflows.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240606164926.3031358-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d69d8048
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}