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>
This commit is contained in:
parent
d0627b201a
commit
e880754467
@ -130,7 +130,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||
cfg[j++] = pinconf_to_config_packed(IMX_SCMI_PIN_DAISY_CFG, input_val);
|
||||
}
|
||||
|
||||
configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
|
||||
configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL);
|
||||
|
||||
new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
|
||||
new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_id);
|
||||
|
Loading…
Reference in New Issue
Block a user