Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: sg: Fix get_user() in call sg_scsi_ioctl()

get_user() expects the pointer to be pointer-to-simple-variable type, but
sic->data is array of 'unsigned char'. It violates get_user() contracts.

Explicitly take pointer to the first element of the array. It matches
current behaviour.

This is preparation for fixing sparse warnings caused by Linear Address
Masking patchset.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lore.kernel.org/r/20221117232304.1544-1-kirill.shutemov@linux.intel.com
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Kirill A. Shutemov and committed by
Martin K. Petersen
4e80eef4 76dc6095

+1 -1
+1 -1
drivers/scsi/scsi_ioctl.c
··· 519 519 return -EFAULT; 520 520 if (in_len > PAGE_SIZE || out_len > PAGE_SIZE) 521 521 return -EINVAL; 522 - if (get_user(opcode, sic->data)) 522 + if (get_user(opcode, &sic->data[0])) 523 523 return -EFAULT; 524 524 525 525 bytes = max(in_len, out_len);