Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2 -2
+2 -2
drivers/scsi/scsicam.c
··· 163 163 end_head * end_sector + end_sector; 164 164 165 165 /* This is the actual _sector_ number at the end */ 166 - logical_end = get_unaligned(&largest->start_sect) 167 - + get_unaligned(&largest->nr_sects); 166 + logical_end = get_unaligned_le32(&largest->start_sect) 167 + + get_unaligned_le32(&largest->nr_sects); 168 168 169 169 /* This is for >1023 cylinders */ 170 170 ext_cyl = (logical_end - (end_head * end_sector + end_sector))