sd: Fix parsing of 'temporary ' cache mode prefix
authorBen Hutchings <ben@decadent.org.uk>
Mon, 27 May 2013 18:07:19 +0000 (19:07 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 27 Jul 2013 04:34:19 +0000 (05:34 +0100)
commit 2ee3e26c673e75c05ef8b914f54fadee3d7b9c88 upstream.

Commit 39c60a0948cc '[SCSI] sd: fix array cache flushing bug causing
performance problems' added temp as a pointer to "temporary " and used
sizeof(temp) - 1 as its length.  But sizeof(temp) is the size of the
pointer, not the size of the string constant.  Change temp to a static
array so that sizeof() does what was intended.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/sd.c

index 931cde0..6dace1a 100644 (file)
@@ -138,7 +138,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
        char *buffer_data;
        struct scsi_mode_data data;
        struct scsi_sense_hdr sshdr;
        char *buffer_data;
        struct scsi_mode_data data;
        struct scsi_sense_hdr sshdr;
-       const char *temp = "temporary ";
+       static const char temp[] = "temporary ";
        int len;
 
        if (sdp->type != TYPE_DISK)
        int len;
 
        if (sdp->type != TYPE_DISK)