Discussion:
[PATCH] scsi: PC partition tables are little endian
(too old to reply)
Christoph Hellwig
2014-10-01 18:31:01 UTC
Permalink
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 <***@lst.de>
---
drivers/scsi/scsicam.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c
index 92d24d6..910f4a7 100644
--- a/drivers/scsi/scsicam.c
+++ b/drivers/scsi/scsicam.c
@@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
end_head * end_sector + end_sector;

/* This is the actual _sector_ number at the end */
- logical_end = get_unaligned(&largest->start_sect)
- + get_unaligned(&largest->nr_sects);
+ logical_end = get_unaligned_le32(&largest->start_sect)
+ + get_unaligned_le32(&largest->nr_sects);

/* This is for >1023 cylinders */
ext_cyl = (logical_end - (end_head * end_sector + end_sector))
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
2014-10-17 13:13:50 UTC
Permalink
ping?
Post by Christoph Hellwig
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.
---
drivers/scsi/scsicam.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c
index 92d24d6..910f4a7 100644
--- a/drivers/scsi/scsicam.c
+++ b/drivers/scsi/scsicam.c
@@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
end_head * end_sector + end_sector;
/* This is the actual _sector_ number at the end */
- logical_end = get_unaligned(&largest->start_sect)
- + get_unaligned(&largest->nr_sects);
+ logical_end = get_unaligned_le32(&largest->start_sect)
+ + get_unaligned_le32(&largest->nr_sects);
/* This is for >1023 cylinders */
ext_cyl = (logical_end - (end_head * end_sector + end_sector))
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hannes Reinecke
2014-10-17 15:24:03 UTC
Permalink
ping?
As sparse correctly pointed out scsi_partsize should use get_unalign=
ed_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 b=
ig
endian systems when using the scsicam variant. Which probably doesn=
't
matter as only old x86 systems every cared about the geometry.
Reviewed-by: Hannes Reinecke <***@suse.de>

Cheers,

Hannes
--=20
Dr. Hannes Reinecke zSeries & Storage
***@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg
GF: J. Hawn, J. Guild, F. Imend=F6rffer, HRB 16746 (AG N=FCrnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" i=
n
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Martin K. Petersen
2014-10-17 23:47:25 UTC
Permalink
Post by Christoph Hellwig
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.
Reviewed-by: Martin K. Petersen <***@oracle.com>
--
Martin K. Petersen Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...