mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
9p: Add const and unsigned to wnames allocation type
In preparation for converting the kmalloc family of allocators to the type-aware kmalloc_obj family, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (The kmalloc family returns "void *", which can be implicitly cast to any pointer type.) The assigned type is "const unsigned char **", but the converted allocation type would be "char **", which differs in both the const qualifier and the signedness of the character type. 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: fs/9p/fid.o Assisted-by: LLM coccinelle Signed-off-by: Kees Cook <kees+treewide@kernel.org> Message-ID: <20260917211158.i.129-kees@kernel.org> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
This commit is contained in:
parent
7b6f2e3c29
commit
a869fe526c
|
|
@ -154,7 +154,7 @@ static int build_path_from_dentry(struct v9fs_session_info *v9ses,
|
|||
for (ds = dentry; !IS_ROOT(ds); ds = ds->d_parent)
|
||||
n++;
|
||||
|
||||
wnames = kmalloc_array(n, sizeof(char *), GFP_KERNEL);
|
||||
wnames = kmalloc_array(n, sizeof(*wnames), GFP_KERNEL);
|
||||
if (!wnames)
|
||||
goto err_out;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user