mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 03:27:30 -04:00
scsi: scsi_ioctl: Use strnlen() in scsi_ioctl_get_pci()
Use strnlen() to limit string scanning to 20 characters. Reformat the code and use tabs instead of spaces while at it. [mkp: tweaked comment formatting] Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: John Garry <john.g.garry@oracle.com> Link: https://patch.msgid.link/20260517171546.2304-2-thorsten.blum@linux.dev Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
016d484531
commit
09be9d404f
@@ -176,10 +176,13 @@ static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
|
||||
|
||||
name = dev_name(dev);
|
||||
|
||||
/* compatibility with old ioctl which only returned
|
||||
* 20 characters */
|
||||
return copy_to_user(arg, name, min(strlen(name), (size_t)20))
|
||||
? -EFAULT: 0;
|
||||
/*
|
||||
* Compatibility with old ioctl which only returned 20 characters.
|
||||
*/
|
||||
if (copy_to_user(arg, name, strnlen(name, 20)))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sg_get_version(int __user *p)
|
||||
|
||||
Reference in New Issue
Block a user