]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
regmap: Switch to use kmemdup_array()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 6 Jun 2024 16:46:22 +0000 (19:46 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 7 Jun 2024 13:28:21 +0000 (14:28 +0100)
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>
drivers/base/regmap/regmap.c

index 0a34dd3c4f38d298b8766065026cc465801f7aa7..88c02b71b2ee125c806c4f4f0df526a2baec790d 100644 (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;