Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/sbc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr/sbc.c b/usr/sbc.c index e58a233..779dacd 100644 --- a/usr/sbc.c +++ b/usr/sbc.c @@ -260,6 +260,9 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd) goto sense; } + lba = scsi_rw_offset(cmd->scb); + tl = scsi_rw_count(cmd->scb); + switch (cmd->scb[0]) { case READ_10: case READ_12: @@ -314,6 +317,10 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd) asc = ASC_PARAMETER_LIST_LENGTH_ERR; goto sense; } + /* TL == 0 means all LBAs until end of device */ + if (tl == 0) + tl = (lu->size >> cmd->dev->blk_shift) - lba; + break; } @@ -339,9 +346,6 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd) } } - lba = scsi_rw_offset(cmd->scb); - tl = scsi_rw_count(cmd->scb); - /* Verify that we are not doing i/o beyond the end-of-lun */ if (tl) { -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html