diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d08169be3..2db1d5950 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -4721,6 +4721,7 @@ static int scst_finish_cmd(struct scst_cmd *cmd) struct scst_session *sess = cmd->sess; struct scst_io_stat_entry *stat; int block_shift, align_len; + uint64_t lba; TRACE_ENTRY(); @@ -4753,12 +4754,14 @@ static int scst_finish_cmd(struct scst_cmd *cmd) block_shift = cmd->dev->block_shift; /* Let's track only 4K unaligned cmds at the moment */ align_len = (block_shift != 0) ? 4095 : 0; + lba = cmd->lba; } else { block_shift = 0; align_len = 0; + lba = 0; } - if (unlikely(((cmd->lba << block_shift) & align_len) != 0) || + if (unlikely(((lba << block_shift) & align_len) != 0) || unlikely(((cmd->bufflen + cmd->out_bufflen) & align_len) != 0)) stat->unaligned_cmd_count++;