* [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
[not found] <20170915100645.17999-1-damien.lemoal@wdc.com>
@ 2017-09-15 10:06 ` Damien Le Moal
2017-09-15 10:46 ` Hannes Reinecke
2017-09-15 17:52 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Damien Le Moal @ 2017-09-15 10:06 UTC (permalink / raw)
To: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe
Cc: Christoph Hellwig, Bart Van Assche, stable
The three values starting at byte 8 of the Zoned Block Device
Characteristics VPD page B6h are 32 bits values, not 64bits. So use
get_unaligned_be32() to retrieve the values and not get_unaligned_be64()
Fixes: 89d947561077 ("sd: Implement support for ZBC devices")
Cc: <stable@vger.kernel.org>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/scsi/sd_zbc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 37b33adbb2ef..7e30d0c22930 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -385,15 +385,15 @@ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp,
if (sdkp->device->type != TYPE_ZBC) {
/* Host-aware */
sdkp->urswrz = 1;
- sdkp->zones_optimal_open = get_unaligned_be64(&buf[8]);
- sdkp->zones_optimal_nonseq = get_unaligned_be64(&buf[12]);
+ sdkp->zones_optimal_open = get_unaligned_be32(&buf[8]);
+ sdkp->zones_optimal_nonseq = get_unaligned_be32(&buf[12]);
sdkp->zones_max_open = 0;
} else {
/* Host-managed */
sdkp->urswrz = buf[4] & 1;
sdkp->zones_optimal_open = 0;
sdkp->zones_optimal_nonseq = 0;
- sdkp->zones_max_open = get_unaligned_be64(&buf[16]);
+ sdkp->zones_max_open = get_unaligned_be32(&buf[16]);
}
return 0;
--
2.13.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
2017-09-15 10:06 ` [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics() Damien Le Moal
@ 2017-09-15 10:46 ` Hannes Reinecke
2017-09-15 17:52 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2017-09-15 10:46 UTC (permalink / raw)
To: Damien Le Moal, linux-scsi, Martin K . Petersen, linux-block,
Jens Axboe
Cc: Christoph Hellwig, Bart Van Assche, stable
On 09/15/2017 12:06 PM, Damien Le Moal wrote:
> The three values starting at byte 8 of the Zoned Block Device
> Characteristics VPD page B6h are 32 bits values, not 64bits. So use
> get_unaligned_be32() to retrieve the values and not get_unaligned_be64()
>
> Fixes: 89d947561077 ("sd: Implement support for ZBC devices")
> Cc: <stable@vger.kernel.org>
>
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/scsi/sd_zbc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index 37b33adbb2ef..7e30d0c22930 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
> @@ -385,15 +385,15 @@ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp,
> if (sdkp->device->type != TYPE_ZBC) {
> /* Host-aware */
> sdkp->urswrz = 1;
> - sdkp->zones_optimal_open = get_unaligned_be64(&buf[8]);
> - sdkp->zones_optimal_nonseq = get_unaligned_be64(&buf[12]);
> + sdkp->zones_optimal_open = get_unaligned_be32(&buf[8]);
> + sdkp->zones_optimal_nonseq = get_unaligned_be32(&buf[12]);
> sdkp->zones_max_open = 0;
> } else {
> /* Host-managed */
> sdkp->urswrz = buf[4] & 1;
> sdkp->zones_optimal_open = 0;
> sdkp->zones_optimal_nonseq = 0;
> - sdkp->zones_max_open = get_unaligned_be64(&buf[16]);
> + sdkp->zones_max_open = get_unaligned_be32(&buf[16]);
> }
>
> return 0;
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
2017-09-15 10:06 ` [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics() Damien Le Moal
2017-09-15 10:46 ` Hannes Reinecke
@ 2017-09-15 17:52 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-09-15 17:52 UTC (permalink / raw)
To: Damien Le Moal
Cc: linux-scsi, Martin K . Petersen, linux-block, Jens Axboe,
Christoph Hellwig, Bart Van Assche, stable
Looks fine,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-15 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20170915100645.17999-1-damien.lemoal@wdc.com>
2017-09-15 10:06 ` [PATCH V3 08/12] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics() Damien Le Moal
2017-09-15 10:46 ` Hannes Reinecke
2017-09-15 17:52 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).