regmap: 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/20240606164717.3031107-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Andy Shevchenko 2024-06-06 19:46:22 +03:00 committed by Mark Brown
parent 0ae7477599
commit f6841d41a8
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -2347,7 +2347,7 @@ out:
} else {
void *wval;
wval = kmemdup(val, val_count * val_bytes, map->alloc_flags);
wval = kmemdup_array(val, val_count, val_bytes, map->alloc_flags);
if (!wval)
return -ENOMEM;