* [PATCH] pinctrl: s32cc: Remove const from groups allocation type
@ 2026-09-17 21:14 Kees Cook
0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2026-09-17 21:14 UTC (permalink / raw)
To: Chester Lin
Cc: Kees Cook, Kees Cook, Matthias Brugger, Ghennadi Procopciuc,
NXP S32 Linux Team, Dong Aisheng, Fabio Estevam, Frank Li,
Jacky Bai, Pengutronix Kernel Team, Linus Walleij,
linux-arm-kernel, linux-gpio, linux-kernel, linux-hardening
From: Kees Cook <kees+treewide@kernel.org>
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.)
The assigned type is "const char **", but the converted allocation type
would be "const char * const *", as the size was taken from
"*func->groups", whose type "const char * const" is const qualified. As
there is no general way to remove const qualifiers, take the size from
the assignment target instead. No change in allocation size results.
Build tested ARCH=arm64 allmodconfig with GCC aarch64-linux-gnu 16.1.0:
drivers/pinctrl/nxp/pinctrl-s32cc.o
Assisted-by: LLM coccinelle
Signed-off-by: Kees Cook <kees+treewide@kernel.org>
---
Cc: Chester Lin <chester62515@gmail.com>
Cc: Matthias Brugger <mbrugger@suse.com>
Cc: Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>
Cc: NXP S32 Linux Team <s32@nxp.com>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Frank Li <Frank.Li@nxp.com>
Cc: Jacky Bai <ping.bai@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Linus Walleij <linusw@kernel.org>
Cc: <linux-arm-kernel@lists.infradead.org>
Cc: <linux-gpio@vger.kernel.org>
---
drivers/pinctrl/nxp/pinctrl-s32cc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c
index 4b40770a38b7..9c4ebae22674 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32cc.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
@@ -825,7 +825,7 @@ static int s32_pinctrl_parse_functions(struct device_node *np,
"No groups defined in %pOF\n", np);
groups = devm_kcalloc(info->dev, func->ngroups,
- sizeof(*func->groups), GFP_KERNEL);
+ sizeof(*groups), GFP_KERNEL);
if (!groups)
return -ENOMEM;
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-17 21:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 21:14 [PATCH] pinctrl: s32cc: Remove const from groups allocation type Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®