mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
scsi: hpsa: Make buff allocation type unsigned
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 "unsigned char **", but the converted allocation type would be "char **", whose elements point to a character type of a different signedness, so the two pointer types are not compatible. 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/scsi/hpsa.o Assisted-by: LLM coccinelle Signed-off-by: Kees Cook <kees+treewide@kernel.org> Link: https://patch.msgid.link/20260917211137.i.357-kees@kernel.org Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
parent
7dec5cedf7
commit
d0105247ca
|
|
@ -6500,7 +6500,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h,
|
|||
return -EINVAL;
|
||||
if (ioc->buf_size > ioc->malloc_size * SG_ENTRIES_IN_CMD)
|
||||
return -EINVAL;
|
||||
buff = kcalloc(SG_ENTRIES_IN_CMD, sizeof(char *), GFP_KERNEL);
|
||||
buff = kcalloc(SG_ENTRIES_IN_CMD, sizeof(*buff), GFP_KERNEL);
|
||||
if (!buff) {
|
||||
status = -ENOMEM;
|
||||
goto cleanup1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user