scsi: qla2xxx: Off by one in qlt_ctio_to_cmd()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 10 Jul 2017 08:47:40 +0000 (11:47 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 12 Jul 2017 21:20:21 +0000 (17:20 -0400)
There are "req->num_outstanding_cmds" elements in the
req->outstanding_cmds[] array so the > here should be >=.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_target.c

index 2a0173e5d10e1d6095fd659163aabde34a8dca2f..986a4270b2ffab8de678c0b13f0807c20c5f3481 100644 (file)
@@ -3747,7 +3747,7 @@ static struct qla_tgt_cmd *qlt_ctio_to_cmd(struct scsi_qla_host *vha,
        h &= QLA_CMD_HANDLE_MASK;
 
        if (h != QLA_TGT_NULL_HANDLE) {
-               if (unlikely(h > req->num_outstanding_cmds)) {
+               if (unlikely(h >= req->num_outstanding_cmds)) {
                        ql_dbg(ql_dbg_tgt, vha, 0xe052,
                            "qla_target(%d): Wrong handle %x received\n",
                            vha->vp_idx, handle);