mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
pinctrl: imx: Remove const from group_names 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=x86_64 allmodconfig with GCC 16.2.0: drivers/pinctrl/freescale/pinctrl-imx.o Assisted-by: LLM coccinelle Signed-off-by: Kees Cook <kees+treewide@kernel.org> Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
parent
cbb91e55a9
commit
07ba49a119
|
|
@ -646,7 +646,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
|
|||
}
|
||||
|
||||
group_names = devm_kcalloc(ipctl->dev, func->ngroups,
|
||||
sizeof(*func->groups), GFP_KERNEL);
|
||||
sizeof(*group_names), GFP_KERNEL);
|
||||
if (!group_names)
|
||||
return -ENOMEM;
|
||||
i = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user