aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_ioctl.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-12-03 16:41:36 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-01-02 11:22:16 -0500
commit71610f55fa4db63dbf5385929a47c9fb2451f332 (patch)
treeb816672eef25e1436111e6c78053612bd22fb016 /drivers/scsi/scsi_ioctl.c
parentb58602a4bac012b5f4fc12fe6b46ab237b610d5d (diff)
[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>
Diffstat (limited to 'drivers/scsi/scsi_ioctl.c')
-rw-r--r--drivers/scsi/scsi_ioctl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 2ae4f8fc5831..b98f763931c5 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -167,10 +167,17 @@ EXPORT_SYMBOL(scsi_set_medium_removal);
167static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg) 167static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
168{ 168{
169 struct device *dev = scsi_get_device(sdev->host); 169 struct device *dev = scsi_get_device(sdev->host);
170 const char *name;
170 171
171 if (!dev) 172 if (!dev)
172 return -ENXIO; 173 return -ENXIO;
173 return copy_to_user(arg, dev->bus_id, sizeof(dev->bus_id))? -EFAULT: 0; 174
175 name = dev_name(dev);
176
177 /* compatibility with old ioctl which only returned
178 * 20 characters */
179 return copy_to_user(arg, name, min(strlen(name), (size_t)20))
180 ? -EFAULT: 0;
174} 181}
175 182
176 183