summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKees Cook <kees+treewide@kernel.org>2026-09-17 14:14:53 -0700
committerLinus Walleij <linusw@kernel.org>2026-10-01 21:47:01 +0200
commitd0833b246581567f8d513e1c7bb52e65690e69d6 (patch)
tree070731f5080bb772d4c536916b609842fddd8113 /drivers
parentd1c4db1ad4f3093535c1271088d11f7f3176eea4 (diff)
pinctrl: s32cc: Remove const from groups 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.) 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> Reviewed-by: Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/nxp/pinctrl-s32cc.c2
1 files changed, 1 insertions, 1 deletions
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;