[SCSI] struct device - replace bus_id with dev_name(), dev_set_name()
[jejb: limit ioctl to returning 20 characters to avoid overrun on long device names and add a few more conversions] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
committed by
James Bottomley
parent
b58602a4ba
commit
71610f55fa
@@ -167,10 +167,17 @@ EXPORT_SYMBOL(scsi_set_medium_removal);
|
||||
static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
|
||||
{
|
||||
struct device *dev = scsi_get_device(sdev->host);
|
||||
const char *name;
|
||||
|
||||
if (!dev)
|
||||
return -ENXIO;
|
||||
return copy_to_user(arg, dev->bus_id, sizeof(dev->bus_id))? -EFAULT: 0;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user