All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: PC partition tables are little endian
@ 2014-10-01 18:31 Christoph Hellwig
  2014-10-17 13:13 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2014-10-01 18:31 UTC (permalink / raw)
  To: linux-scsi

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>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: PC partition tables are little endian
  2014-10-01 18:31 [PATCH] scsi: PC partition tables are little endian Christoph Hellwig
@ 2014-10-17 13:13 ` Christoph Hellwig
  2014-10-17 15:24   ` Hannes Reinecke
  2014-10-17 23:47   ` Martin K. Petersen
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2014-10-17 13:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, Hannes Reinecke, Martin K. Petersen, Douglas Gilbert

ping?

On Wed, Oct 01, 2014 at 08:31:01PM +0200, Christoph Hellwig wrote:
> 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>
> ---
>  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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: PC partition tables are little endian
  2014-10-17 13:13 ` Christoph Hellwig
@ 2014-10-17 15:24   ` Hannes Reinecke
  2014-10-17 23:47   ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2014-10-17 15:24 UTC (permalink / raw)
  To: Christoph Hellwig, Christoph Hellwig
  Cc: linux-scsi, Martin K. Petersen, Douglas Gilbert

On 10/17/2014 03:13 PM, Christoph Hellwig wrote:
> ping?
>
> On Wed, Oct 01, 2014 at 08:31:01PM +0200, Christoph Hellwig wrote:
>> 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: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: PC partition tables are little endian
  2014-10-17 13:13 ` Christoph Hellwig
  2014-10-17 15:24   ` Hannes Reinecke
@ 2014-10-17 23:47   ` Martin K. Petersen
  1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2014-10-17 23:47 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Christoph Hellwig, linux-scsi, Hannes Reinecke,
	Martin K. Petersen, Douglas Gilbert

>>>>> "Christoph" == Christoph Hellwig <hch@infradead.org> writes:

>> 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 <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-17 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 18:31 [PATCH] scsi: PC partition tables are little endian Christoph Hellwig
2014-10-17 13:13 ` Christoph Hellwig
2014-10-17 15:24   ` Hannes Reinecke
2014-10-17 23:47   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.