pinctrl: renesas: Switch to use kmemdup_array()
Let kmemdup_array() take care of multiplication and possible overflow. Signed-off-by: Shen Lichuan <shenlichuan@vivo.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20240822061438.14617-1-shenlichuan@vivo.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
This commit is contained in:
parent
f73f63b244
commit
5e633f572b
@ -528,8 +528,7 @@ static int rzg2l_map_add_config(struct pinctrl_map *map,
|
||||
{
|
||||
unsigned long *cfgs;
|
||||
|
||||
cfgs = kmemdup(configs, num_configs * sizeof(*cfgs),
|
||||
GFP_KERNEL);
|
||||
cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL);
|
||||
if (!cfgs)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -196,8 +196,7 @@ static int rzv2m_map_add_config(struct pinctrl_map *map,
|
||||
{
|
||||
unsigned long *cfgs;
|
||||
|
||||
cfgs = kmemdup(configs, num_configs * sizeof(*cfgs),
|
||||
GFP_KERNEL);
|
||||
cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL);
|
||||
if (!cfgs)
|
||||
return -ENOMEM;
|
||||
|
||||
|
@ -83,8 +83,7 @@ static int sh_pfc_map_add_config(struct pinctrl_map *map,
|
||||
{
|
||||
unsigned long *cfgs;
|
||||
|
||||
cfgs = kmemdup(configs, num_configs * sizeof(*cfgs),
|
||||
GFP_KERNEL);
|
||||
cfgs = kmemdup_array(configs, num_configs, sizeof(*cfgs), GFP_KERNEL);
|
||||
if (cfgs == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user