summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/mediatek
diff options
context:
space:
mode:
authorKees Cook <kees+treewide@kernel.org>2026-09-17 14:13:24 -0700
committerLinus Walleij <linusw@kernel.org>2026-09-30 15:20:24 +0200
commitcbb91e55a9d5227e53531ec5cc726411c9196a3d (patch)
tree04b88dd66d9e1dac138b56cb8fb4a225f01c2e72 /drivers/pinctrl/mediatek
parent5678facf8979f62fb56d6554b81bf9cf3a9346fc (diff)
downloadlinux-next-cbb91e55a9d5227e53531ec5cc726411c9196a3d.tar.gz
linux-next-cbb91e55a9d5227e53531ec5cc726411c9196a3d.zip
pinctrl: mediatek: Fix eint->base allocation type
In preparation for making the devm_kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) This allocates the single-entry array that mtk-eint expects (nbase is set to 1). The assigned type is "void __iomem **", but the converted allocation type would be "void __iomem ***", as the size was taken from "pctl->eint->base" itself rather than from what it points at. Luckily "void __iomem **" and "void __iomem *" are the same size. Take the size from the pointed-at type to match the assignment. Build tested ARCH=x86_64 allmodconfig with GCC 16.2.0: drivers/pinctrl/mediatek/pinctrl-mtk-common.o Assisted-by: LLM coccinelle Signed-off-by: Kees Cook <kees+treewide@kernel.org> Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 1a977acd6883..857d39f3438d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1032,7 +1032,8 @@ 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;