lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2e697dfc-2575-469c-9ba2-4470db34b5d1@gmail.com>
Date: Mon, 24 Nov 2025 22:27:01 +0530
From: Bhanu Seshu Kumar Valluri <bhanuseshukumar@...il.com>
To: Don Brace <don.brace@...rochip.com>,
 "James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
 "Martin K . Petersen" <martin.petersen@...cle.com>
Cc: storagedev@...rochip.com, linux-scsi@...r.kernel.org,
 linux-kernel@...r.kernel.org, khalid@...nel.org,
 linux-kernel-mentees@...ts.linuxfoundation.org, skhan@...uxfoundation.org,
 david.hunter.linux@...il.com, cassel@...nel.org
Subject: Re: [PATCH v2] scsi: Prefer kmalloc_array over kmalloc involving
 dynamic size calculations

On 07/10/25 12:23, Bhanu Seshu Kumar Valluri wrote:
> As a best practice use kmalloc_array to safely calculate dynamic object
> sizes without overflow.
> 
> Acked-by: Don Brace <don.brace@...rochip.com>
> Signed-off-by: Bhanu Seshu Kumar Valluri <bhanuseshukumar@...il.com>
> ---
>  Note: The patch is tested for compilation.
>  Change log:
>  v1->v2:
>   Updated commit message to refelect correct intention of the patch to 
>   address James Bottomley review in v1.
>   v1 Link : https://lore.kernel.org/all/20251001113935.52596-1-bhanuseshukumar@gmail.com/
>  drivers/scsi/smartpqi/smartpqi_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> index 03c97e60d36f..19b0075eb256 100644
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
> @@ -8936,7 +8936,7 @@ 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;
>  

Hi,

I just wanted to check if you had a chance to review it or if any changes are needed from my side.

Regards,
Bhanu Seshu Kumar Valluri

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ