Skip to content

Commit ca428f1

Browse files
Shen Lichuanlinusw
authored andcommitted
drivers/pinctrl: Switch to use kmemdup_array()
Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Shen Lichuan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 0f978da commit ca428f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pinctrl/pinctrl-utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ int pinctrl_utils_add_map_configs(struct pinctrl_dev *pctldev,
7070
if (WARN_ON(*num_maps == *reserved_maps))
7171
return -ENOSPC;
7272

73-
dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs),
74-
GFP_KERNEL);
73+
dup_configs = kmemdup_array(configs, num_configs,
74+
sizeof(*dup_configs), GFP_KERNEL);
7575
if (!dup_configs)
7676
return -ENOMEM;
7777

0 commit comments

Comments
 (0)