Commit 678e2757 authored by Christoph Hellwig's avatar Christoph Hellwig

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
parent 037e6d86
...@@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity, ...@@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
end_head * end_sector + end_sector; end_head * end_sector + end_sector;
/* This is the actual _sector_ number at the end */ /* This is the actual _sector_ number at the end */
logical_end = get_unaligned(&largest->start_sect) logical_end = get_unaligned_le32(&largest->start_sect)
+ get_unaligned(&largest->nr_sects); + get_unaligned_le32(&largest->nr_sects);
/* This is for >1023 cylinders */ /* This is for >1023 cylinders */
ext_cyl = (logical_end - (end_head * end_sector + end_sector)) ext_cyl = (logical_end - (end_head * end_sector + end_sector))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment