Message ID | 20180703062358.7980-1-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 07/03/2018 08:23 AM, Damien Le Moal wrote: > Fix the description of sd_zbc_check_zone_size() to correctly explain > that the returned value is a number of device blocks, not bytes. > Additionally, the 32 bits "ret" variable used in this function may > truncate the 64 bits zone_blocks variable value upon return. To fix > this, change "ret" type to s64. > > Fixes: ccce20fc79 ("sd_zbc: Avoid that resetting a zone fails sporadically") > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> > Cc: Bart Van Assche <bart.vanassche@wdc.com> > Cc: stable@kernel.org > --- > drivers/scsi/sd_zbc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c > index a14fef11776e..2bf3bf73886e 100644 > --- a/drivers/scsi/sd_zbc.c > +++ b/drivers/scsi/sd_zbc.c > @@ -391,7 +391,8 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf) > * Check that all zones of the device are equal. The last zone can however > * be smaller. The zone size must also be a power of two number of LBAs. > * > - * Returns the zone size in bytes upon success or an error code upon failure. > + * Returns the zone size in number of blocks upon success or an error code > + * upon failure. > */ > static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) > { > @@ -401,7 +402,7 @@ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) > unsigned char *rec; > unsigned int buf_len; > unsigned int list_length; > - int ret; > + s64 ret; > u8 same; > > /* Get a buffer */ > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
On 07/02/18 23:23, Damien Le Moal wrote: > Fix the description of sd_zbc_check_zone_size() to correctly explain > that the returned value is a number of device blocks, not bytes. > Additionally, the 32 bits "ret" variable used in this function may > truncate the 64 bits zone_blocks variable value upon return. To fix > this, change "ret" type to s64. Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Damien, > Fix the description of sd_zbc_check_zone_size() to correctly explain > that the returned value is a number of device blocks, not bytes. > Additionally, the 32 bits "ret" variable used in this function may > truncate the 64 bits zone_blocks variable value upon return. To fix > this, change "ret" type to s64. Applied to 4.18/scsi-fixes, thank you!
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index a14fef11776e..2bf3bf73886e 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -391,7 +391,8 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf) * Check that all zones of the device are equal. The last zone can however * be smaller. The zone size must also be a power of two number of LBAs. * - * Returns the zone size in bytes upon success or an error code upon failure. + * Returns the zone size in number of blocks upon success or an error code + * upon failure. */ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) { @@ -401,7 +402,7 @@ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) unsigned char *rec; unsigned int buf_len; unsigned int list_length; - int ret; + s64 ret; u8 same; /* Get a buffer */
Fix the description of sd_zbc_check_zone_size() to correctly explain that the returned value is a number of device blocks, not bytes. Additionally, the 32 bits "ret" variable used in this function may truncate the 64 bits zone_blocks variable value upon return. To fix this, change "ret" type to s64. Fixes: ccce20fc79 ("sd_zbc: Avoid that resetting a zone fails sporadically") Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Cc: Bart Van Assche <bart.vanassche@wdc.com> Cc: stable@kernel.org --- drivers/scsi/sd_zbc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)