]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sparse: scsi_ioctl __user annotation
authorAlexander Viro <viro@www.linux.org.uk>
Sat, 29 May 2004 09:17:28 +0000 (02:17 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 29 May 2004 09:17:28 +0000 (02:17 -0700)
scsi_ioctl() and scsi_ioctl_send_command() switched to __user *;
scsi/scsi_ioctl.c annotated.

drivers/scsi/osst.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/sr_ioctl.c
drivers/scsi/st.c
include/scsi/scsi_ioctl.h

index 59d5199cc5a453e60614987e58299161986cc9bc..74a1a55272b86e727840051457bd01af05502804 100644 (file)
@@ -5040,7 +5040,7 @@ static int osst_ioctl(struct inode * inode,struct file * file,
 
        up(&STp->lock);
 
-       return scsi_ioctl(STp->device, cmd_in, (void *) arg);
+       return scsi_ioctl(STp->device, cmd_in, p);
 
 out:
        if (SRpnt) scsi_release_request(SRpnt);
index 53d4b5dd53445ba2dded358ac419a91c3df9c042..03390c0786ff19dc10896194d369ce65f7850aa9 100644 (file)
  * (int *) arg
  */
 
-static int ioctl_probe(struct Scsi_Host *host, void *buffer)
+static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
 {
        unsigned int len, slen;
        const char *string;
        int temp = host->hostt->present;
 
        if (temp && buffer) {
-               if (get_user(len, (unsigned int *) buffer))
+               if (get_user(len, (unsigned int __user *) buffer))
                        return -EFAULT;
 
                if (host->hostt->info)
@@ -204,11 +204,11 @@ int scsi_set_medium_removal(struct scsi_device *sdev, char state)
 #define OMAX_SB_LEN 16         /* Old sense buffer length */
 
 int scsi_ioctl_send_command(struct scsi_device *sdev,
-                           struct scsi_ioctl_command *sic)
+                           struct scsi_ioctl_command __user *sic)
 {
        char *buf;
        unsigned char cmd[MAX_COMMAND_SIZE];
-       char *cmd_in;
+       char __user *cmd_in;
        struct scsi_request *sreq;
        unsigned char opcode;
        unsigned int inlen, outlen, cmdlen;
@@ -361,7 +361,7 @@ error:
  *                  device)
  *          any copy_to_user() error on failure there
  */
-static int scsi_ioctl_get_pci(struct scsi_device *sdev, void *arg)
+static int scsi_ioctl_get_pci(struct scsi_device *sdev, void __user *arg)
 {
        struct device *dev = scsi_get_device(sdev->host);
 
@@ -376,7 +376,7 @@ static int scsi_ioctl_get_pci(struct scsi_device *sdev, void *arg)
  * not take a major/minor number as the dev field.  Rather, it takes
  * a pointer to a scsi_devices[] element, a structure. 
  */
-int scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg)
+int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
 {
        char scsi_cmd[MAX_COMMAND_SIZE];
 
@@ -402,19 +402,18 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg)
                         + ((sdev->lun & 0xff) << 8)
                         + ((sdev->channel & 0xff) << 16)
                         + ((sdev->host->host_no & 0xff) << 24),
-                        &((struct scsi_idlun *)arg)->dev_id);
+                        &((struct scsi_idlun __user *)arg)->dev_id);
                __put_user(sdev->host->unique_id,
-                        &((struct scsi_idlun *)arg)->host_unique_id);
+                        &((struct scsi_idlun __user *)arg)->host_unique_id);
                return 0;
        case SCSI_IOCTL_GET_BUS_NUMBER:
-               return put_user(sdev->host->host_no, (int *)arg);
+               return put_user(sdev->host->host_no, (int __user *)arg);
        case SCSI_IOCTL_PROBE_HOST:
                return ioctl_probe(sdev->host, arg);
        case SCSI_IOCTL_SEND_COMMAND:
                if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
                        return -EACCES;
-               return scsi_ioctl_send_command(sdev,
-                               (struct scsi_ioctl_command *)arg);
+               return scsi_ioctl_send_command(sdev, arg);
        case SCSI_IOCTL_DOORLOCK:
                return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT);
        case SCSI_IOCTL_DOORUNLOCK:
index cfa87c2c2838a895c4e8084256800c5b21385458..9d29d78e1518ca81929e0b4dbae4cfaab72be7b5 100644 (file)
@@ -590,13 +590,13 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
        switch (cmd) {
                case SCSI_IOCTL_GET_IDLUN:
                case SCSI_IOCTL_GET_BUS_NUMBER:
-                       return scsi_ioctl(sdp, cmd, (void *)arg);
+                       return scsi_ioctl(sdp, cmd, p);
                default:
                        error = scsi_cmd_ioctl(disk, cmd, p);
                        if (error != -ENOTTY)
                                return error;
        }
-       return scsi_ioctl(sdp, cmd, (void *)arg);
+       return scsi_ioctl(sdp, cmd, p);
 }
 
 static void set_media_not_present(struct scsi_disk *sdkp)
index a1fc62418bc3ba2d099e72370123f7fa393a9eaf..fb351cd81c801ca09c8ec0574c9e3a8689775039 100644 (file)
@@ -990,7 +990,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
                        if (!sg_allow_access(opcode, sdp->device->type))
                                return -EPERM;
                }
-               return scsi_ioctl_send_command(sdp->device, (void *) arg);
+               return scsi_ioctl_send_command(sdp->device, (void __user *) arg);
        case SG_SET_DEBUG:
                result = get_user(val, (int *) arg);
                if (result)
@@ -1003,11 +1003,11 @@ sg_ioctl(struct inode *inode, struct file *filp,
        case SG_GET_TRANSFORM:
                if (sdp->detached)
                        return -ENODEV;
-               return scsi_ioctl(sdp->device, cmd_in, (void *) arg);
+               return scsi_ioctl(sdp->device, cmd_in, (void __user *)arg);
        default:
                if (read_only)
                        return -EPERM;  /* don't know so take safe approach */
-               return scsi_ioctl(sdp->device, cmd_in, (void *) arg);
+               return scsi_ioctl(sdp->device, cmd_in, (void __user *)arg);
        }
 }
 
index 2d7dc6cfbda048daeaeaaf1064f2b98a2e979a84..9c3ddba40ded124a834688a5b627ab7f6dc7b510 100644 (file)
@@ -499,7 +499,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
         switch (cmd) {
                 case SCSI_IOCTL_GET_IDLUN:
                 case SCSI_IOCTL_GET_BUS_NUMBER:
-                        return scsi_ioctl(sdev, cmd, (void *)arg);
+                        return scsi_ioctl(sdev, cmd, (void __user *)arg);
        }
        return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
 }
index d82dd4ffecf7f0d86e333239f15c89da5a5cf82b..3fc83dc73782f45c34975df2ed395e2638275e3c 100644 (file)
@@ -541,5 +541,5 @@ int sr_dev_ioctl(struct cdrom_device_info *cdi,
                 unsigned int cmd, unsigned long arg)
 {
        Scsi_CD *cd = cdi->handle;
-       return scsi_ioctl(cd->device, cmd, (void *)arg);
+       return scsi_ioctl(cd->device, cmd, (void __user *)arg);
 }
index 5ae96148a92b0834bcae551c3ebf864a5db2d183..bba9385d008b72535fa374f7f646ca40575fbda5 100644 (file)
@@ -3418,7 +3418,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
                                return i;
                        break;
        }
-       return scsi_ioctl(STp->device, cmd_in, (void *) arg);
+       return scsi_ioctl(STp->device, cmd_in, p);
 
  out:
        up(&STp->lock);
index 316c2fa044bacd9b80a707508a8c501aabd9ca6e..688fa25e7d3937005ae85d64a1ea9f1306a2d25f 100644 (file)
@@ -40,10 +40,10 @@ typedef struct scsi_fctargaddress {
        unsigned char host_wwn[8]; // include NULL term.
 } Scsi_FCTargAddress;
 
-extern int scsi_ioctl(struct scsi_device *, int, void *);
+extern int scsi_ioctl(struct scsi_device *, int, void __user *);
 extern int kernel_scsi_ioctl(struct scsi_device *, int , void *);
 extern int scsi_ioctl_send_command(struct scsi_device *,
-                                  struct scsi_ioctl_command *);
+                                  struct scsi_ioctl_command __user *);
 
 #endif /* __KERNEL__ */
 #endif /* _SCSI_IOCTL_H */