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>
This commit is contained in:
committed by
Martin K. Petersen
parent
81cb6c228f
commit
05e66c18e3
@@ -8936,7 +8936,8 @@ static int pqi_host_alloc_mem(struct pqi_ctrl_info *ctrl_info,
|
||||
if (sg_count == 0 || sg_count > PQI_HOST_MAX_SG_DESCRIPTORS)
|
||||
goto out;
|
||||
|
||||
host_memory_descriptor->host_chunk_virt_address = kmalloc(sg_count * sizeof(void *), GFP_KERNEL);
|
||||
host_memory_descriptor->host_chunk_virt_address =
|
||||
kmalloc_array(sg_count, sizeof(void *), GFP_KERNEL);
|
||||
if (!host_memory_descriptor->host_chunk_virt_address)
|
||||
goto out;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user