summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-10-01 14:31:01 -0400
committerChristoph Hellwig <hch@lst.de>2014-11-12 05:15:54 -0500
commit678e27573237a0b065defdf99e5070c9b0c403c3 (patch)
treef680a5244c9d1e1b63eeb4adf57c57c05a115636
parent037e6d8654469051e6a75d64e6c2d6727130fe4c (diff)
scsi: PC partition tables are little endian
As sparse correctly pointed out, scsi_partsize should use get_unaligned_le32 to read PC partition tables from disk, as they are little endian. The result of this bug is that we returned incorrect geometries on big endian systems when using the scsicam variant. Which probably doesn't matter as only old x86 systems every cared about the geometry. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de>
-rw-r--r--drivers/scsi/scsicam.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c
index 92d24d6dcb39..910f4a7a3924 100644
--- a/drivers/scsi/scsicam.c
+++ b/drivers/scsi/scsicam.c
@@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
163 end_head * end_sector + end_sector; 163 end_head * end_sector + end_sector;
164 164
165 /* This is the actual _sector_ number at the end */ 165 /* This is the actual _sector_ number at the end */
166 logical_end = get_unaligned(&largest->start_sect) 166 logical_end = get_unaligned_le32(&largest->start_sect)
167 + get_unaligned(&largest->nr_sects); 167 + get_unaligned_le32(&largest->nr_sects);
168 168
169 /* This is for >1023 cylinders */ 169 /* This is for >1023 cylinders */
170 ext_cyl = (logical_end - (end_head * end_sector + end_sector)) 170 ext_cyl = (logical_end - (end_head * end_sector + end_sector))