[SCSI] fix sense buffer length handling problem
authorJames Bottomley <James.Bottomley@steeleye.com>
Tue, 9 Aug 2005 16:55:36 +0000 (11:55 -0500)
committerJames Bottomley <jejb@mulgrave.(none)>
Sun, 28 Aug 2005 16:34:12 +0000 (11:34 -0500)
The new bio code was incorrectly converted from stack allocated to
kmalloc'd buffer handling.  There are two places where it incorrectly
uses sizeof(*sense) to get the size of the sense buffer.  This
actually produces one, so no sense data was ever getting back, causing
failure in things like disk spin up.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_lib.c

index 58da7f64c22f00294662002d59802fdbd6cb89b2..72a47ce7a1d3c5c2af072ac45574182c2acada4e 100644 (file)
@@ -342,12 +342,12 @@ int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
                sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
                if (!sense)
                        return DRIVER_ERROR << 24;
-               memset(sense, 0, sizeof(*sense));
+               memset(sense, 0, SCSI_SENSE_BUFFERSIZE);
        }
        result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen,
                                  sense, timeout, retries, 0);
        if (sshdr)
-               scsi_normalize_sense(sense, sizeof(*sense), sshdr);
+               scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, sshdr);
 
        kfree(sense);
        return result;