scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
[ Upstream commit 606c54ae975ad3af540b505b46b55a687501711f ]
Starting from commit 05c6c029a4
("scsi: pm80xx: Increase number of
supported queues") driver initializes only max_q_num queues. Do not use an
invalid queue if the WARN_ON condition is true.
Link: https://lore.kernel.org/r/20211101232825.2350233-4-ipylypiv@google.com
Fixes: 7640e1eb8c5d ("scsi: pm80xx: Make mpi_build_cmd locking consistent")
Reviewed-by: Vishakha Channapattan <vishakhavc@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
c5f414d69a
commit
999528d8a7
@@ -1323,7 +1323,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
|
||||
int q_index = circularQ - pm8001_ha->inbnd_q_tbl;
|
||||
int rv = -1;
|
||||
|
||||
WARN_ON(q_index >= PM8001_MAX_INB_NUM);
|
||||
if (WARN_ON(q_index >= pm8001_ha->max_q_num))
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&circularQ->iq_lock, flags);
|
||||
rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size,
|
||||
&pMessage);
|
||||
|
Reference in New Issue
Block a user