Skip to content

Commit e880754

Browse files
Shen Lichuanlinusw
authored andcommitted
pinctrl: freescale: imx-scmi: Use kmemdup_array instead of kmemdup for multiple allocation
Let the kmemdup_array() take care about multiplication and possible overflows. Signed-off-by: Shen Lichuan <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent d0627b2 commit e880754

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/freescale/pinctrl-imx-scmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
130130
cfg[j++] = pinconf_to_config_packed(IMX_SCMI_PIN_DAISY_CFG, input_val);
131131
}
132132

133-
configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
133+
configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
134134

135135
new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
136136
new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_id);

0 commit comments

Comments
 (0)