Skip to content

Commit f6841d4

Browse files
andy-shevbroonie
authored andcommitted
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>
1 parent 0ae7477 commit f6841d4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/base/regmap/regmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2347,7 +2347,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
23472347
} else {
23482348
void *wval;
23492349

2350-
wval = kmemdup(val, val_count * val_bytes, map->alloc_flags);
2350+
wval = kmemdup_array(val, val_count, val_bytes, map->alloc_flags);
23512351
if (!wval)
23522352
return -ENOMEM;
23532353

0 commit comments

Comments
 (0)