Re: [PATCH] pinctrl: s32cc: Remove const from groups allocation type
From: Linus Walleij
Date: Thu Oct 01 2026 - 03:58:43 EST
On Thu, Sep 17, 2026 at 11:14 PM Kees Cook <kees@xxxxxxxxxx> wrote:
> From: Kees Cook <kees+treewide@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
Patch applied!
Yours,
Linus Walleij