mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
driver core: platform: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240606164926.3031358-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d69d804845
commit
23c6859677
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue