Commit 763ccb4d authored by Damien Le Moal's avatar Damien Le Moal Committed by Greg Kroah-Hartman
Browse files

scsi: sd_zbc: Fix variable type and bogus comment



commit f13cff6c upstream.

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: ccce20fc ("sd_zbc: Avoid that resetting a zone fails sporadically")
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: stable@kernel.org
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ecc160ec
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -430,7 +430,8 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp,
 * 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)
{
@@ -440,7 +441,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 */