Skip to content

Commit e880754

Browse files
Shen LichuanLinus Walleij
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 <shenlichuan@vivo.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/20240823105421.50017-1-shenlichuan@vivo.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent d0627b2 commit e880754

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)