]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/scsi_ioctl.c
[PATCH] qla2xxx: Close window on race between rport removal and fcport transition.
[linux-2.6-omap-h63xx.git] / drivers / scsi / scsi_ioctl.c
index b7fddac813474c0903d37d88e6f6f7ec03b092f5..0bba7d8eebb0a000ab2a89169cc7923aab3d748b 100644 (file)
@@ -122,13 +122,9 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                                break;
                        }
                default:        /* Fall through for non-removable media */
-                       printk(KERN_INFO "ioctl_internal_command: <%d %d %d "
-                              "%d> return code = %x\n",
-                              sdev->host->host_no,
-                              sdev->channel,
-                              sdev->id,
-                              sdev->lun,
-                              result);
+                       sdev_printk(KERN_INFO, sdev,
+                                   "ioctl_internal_command return code = %x\n",
+                                   result);
                        scsi_print_sense_hdr("   ", &sshdr);
                        break;
                }
@@ -205,7 +201,8 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
        unsigned int inlen, outlen, cmdlen;
        unsigned int needed, buf_needed;
        int timeout, retries, result;
-       int data_direction, gfp_mask = GFP_KERNEL;
+       int data_direction;
+       gfp_t gfp_mask = GFP_KERNEL;
 
        if (!sic)
                return -EINVAL;
@@ -281,7 +278,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
         * Obtain the data to be sent to the device (if any).
         */
 
-       if(copy_from_user(buf, cmd_in + cmdlen, inlen))
+       if(inlen && copy_from_user(buf, cmd_in + cmdlen, inlen))
                goto error;
 
        switch (opcode) {
@@ -325,7 +322,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
                if (copy_to_user(cmd_in, sense, sb_len))
                        result = -EFAULT;
        } else {
-               if (copy_to_user(cmd_in, buf, outlen))
+               if (outlen && copy_to_user(cmd_in, buf, outlen))
                        result = -EFAULT;
        }       
 
@@ -458,7 +455,7 @@ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
         * error processing, as long as the device was opened
         * non-blocking */
        if (filp && filp->f_flags & O_NONBLOCK) {
-               if (sdev->host->shost_state == SHOST_RECOVERY)
+               if (scsi_host_in_recovery(sdev->host))
                        return -ENODEV;
        } else if (!scsi_block_when_processing_errors(sdev))
                return -ENODEV;