Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: smartpqi: Prefer kmalloc_array() over kmalloc()

As a best practice use kmalloc_array() to safely calculate dynamic
object sizes without overflow.

[mkp: line exceeding 100 chars, added newline]

Acked-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Bhanu Seshu Kumar Valluri <bhanuseshukumar@gmail.com>
Link: https://patch.msgid.link/20251007065345.8853-1-bhanuseshukumar@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bhanu Seshu Kumar Valluri and committed by
Martin K. Petersen
05e66c18 81cb6c22

+2 -1
+2 -1
drivers/scsi/smartpqi/smartpqi_init.c
··· 8936 8936 if (sg_count == 0 || sg_count > PQI_HOST_MAX_SG_DESCRIPTORS) 8937 8937 goto out; 8938 8938 8939 - host_memory_descriptor->host_chunk_virt_address = kmalloc(sg_count * sizeof(void *), GFP_KERNEL); 8939 + host_memory_descriptor->host_chunk_virt_address = 8940 + kmalloc_array(sg_count, sizeof(void *), GFP_KERNEL); 8940 8941 if (!host_memory_descriptor->host_chunk_virt_address) 8941 8942 goto out; 8942 8943