Commit 4575962a authored by Harshit Mogalapalli's avatar Harshit Mogalapalli Committed by Linus Walleij

pinctrl: sophgo: fix double free in cv1800_pctrl_dt_node_to_map()

'map' is allocated using devm_* which takes care of freeing the allocated
data, but in error paths there is a call to pinctrl_utils_free_map()
which also does kfree(map) which leads to a double free.

Use kcalloc() instead of devm_kcalloc() as freeing is manually handled.

Fixes: a29d8e93 ("pinctrl: sophgo: add support for CV1800B SoC")
Signed-off-by: default avatarHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://lore.kernel.org/20241010111830.3474719-1-harshit.m.mogalapalli@oracle.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c9560bae
...@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -221,7 +221,7 @@ static int cv1800_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
if (!grpnames) if (!grpnames)
return -ENOMEM; return -ENOMEM;
map = devm_kcalloc(dev, ngroups * 2, sizeof(*map), GFP_KERNEL); map = kcalloc(ngroups * 2, sizeof(*map), GFP_KERNEL);
if (!map) if (!map)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment