Re: [PATCH] scsi: smartpqi: Replace kmalloc + copy_from_user with memdup_user
From: Don.Brace
Date: Tue Sep 23 2025 - 12:17:12 EST
________________________________________
From: Thorsten Blum <thorsten.blum@xxxxxxxxx>
Sent: Monday, September 22, 2025 3:18 PM
To: Don Brace - C33706 <Don.Brace@xxxxxxxxxxxxx>; James E.J. Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>; Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Cc: Thorsten Blum <thorsten.blum@xxxxxxxxx>; storagedev <storagedev@xxxxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx <linux-scsi@xxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>
Subject: [PATCH] scsi: smartpqi: Replace kmalloc + copy_from_user with memdup_user
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Replace kmalloc() followed by copy_from_user() with memdup_user() to
simplify and improve pqi_passthru_ioctl().
Since memdup_user() already allocates memory, use kzalloc() in the else
branch instead of manually zeroing 'kernel_buffer' using memset(0).
Return early if an error occurs. No functional changes intended.
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
Acked-by: Don Brace <don.brace@xxxxxxxxxxxxx>
Sorry about duplicate e-mail, forgot to switch to text-only.