]> 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 de7f98cc38feb020863323b06e4fd6d2e4f426a9..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;
        }