summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2018-05-31 11:42:40 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-06-06 04:18:41 +0300
commit3aadbe2523cab462da24c62d9cac5e018a6e69d5 (patch)
treed112391fa6d11eced27cbe280fed2721cb5a2b11 /drivers/scsi
parenta0c1c185fbe2cd6052059604380b26441e2f935f (diff)
downloadlinux-3aadbe2523cab462da24c62d9cac5e018a6e69d5.tar.xz
scsi: sd_zbc: Fix sd_zbc_check_zone_size() error path
If a drive with variable zone sizes or an invalid last zone size is detected, the local variable this_zone_blocks is set to 0 and early return from the function triggered, but this does not result in an error return. The local variable zone_blocks must be set to 0 for an error to be returned. [mkp: typo in commit description] Fixes: ccce20fc7968 ("scsi: 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> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd_zbc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 210407cd2341..ff1ba996d87b 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -452,7 +452,7 @@ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp)
} else if (this_zone_blocks != zone_blocks &&
(block + this_zone_blocks < sdkp->capacity
|| this_zone_blocks > zone_blocks)) {
- this_zone_blocks = 0;
+ zone_blocks = 0;
goto out;
}
block += this_zone_blocks;