Skip to content

Commit

Permalink
scsi: sd_zbc: Fix sd_zbc_check_zone_size() error path
Browse files Browse the repository at this point in the history
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: ccce20f ("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>
  • Loading branch information
Damien Le Moal authored and Martin K. Petersen committed Jun 6, 2018
1 parent a0c1c18 commit 3aadbe2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/sd_zbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3aadbe2

Please sign in to comment.