Skip to contentSkip to conversation

pinctrl: mediatek: Fix sizeof argument pctl->eint->base

PATCH In review Colin Ian King 2 participants 2 messages Apr 24, 2025 – Apr 29, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: mediatek: Fix sizeof argument pctl->eint->base

The sizeof argument is incorrect when allocating pctl->eint->base, it should be *pctl->eint->base. (Generally, the size of void * is the same as void ** so nothing is breaking in this specific case). Fix this.

Fixes fe412e3a6c97 ("pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers")
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +1 -1
index 8596f3541265..4c2b72a3543a 100644
@@ -1017,7 +1017,7 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
 
 	pctl->eint->nbase = 1;
 	/* mtk-eint expects an array */
-	pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(pctl->eint->base), GFP_KERNEL);
+	pctl->eint->base = devm_kzalloc(pctl->dev, sizeof(*pctl->eint->base), GFP_KERNEL);
 	if (!pctl->eint->base)
 		return -ENOMEM;
 
Signature · 1 line
2.49.0
#1 lore raw
Quoted 6 lines · Colin Ian King

The sizeof argument is incorrect when allocating pctl->eint->base, it should be *pctl->eint->base. (Generally, the size of void * is the same as void ** so nothing is breaking in this specific case). Fix this.

Fixes fe412e3a6c97 ("pinctrl: mediatek: common-v1: Fix EINT breakage on older controllers")

The mtk eint handling has been refactored fixing this issue in the process (AFAICT) so the patch does not apply to my devel branch.

Yours,
Linus Walleij