]> Gentwo Git Trees - linux/.git/commit
scsi: smartpqi: Replace kmalloc() + copy_from_user() with memdup_user()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 22 Sep 2025 20:18:33 +0000 (22:18 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 25 Sep 2025 01:41:24 +0000 (21:41 -0400)
commit0ac3c901fbeb87d7aaa89e913dbd692dd342c3a8
tree8995dd07251b73495adde07911af93f5d63f7abe
parentac01fc418f586c6a6e5582da16de7324e9c6391a
scsi: smartpqi: Replace kmalloc() + copy_from_user() with memdup_user()

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@linux.dev>
Acked-by: Don Brace <don.brace@microchip.com>
Message-Id: <20250922201832.1697874-2-thorsten.blum@linux.dev>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/smartpqi/smartpqi_init.c