Thread (23 messages) 23 messages, 1 author, 2021-02-11
STALE1991d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 02/22] lpfc: Fix vport indices in lpfc_find_vport_by_vpid()

From: James Smart <hidden>
Date: 2021-02-11 23:45:52
Subsystem: emulex/broadcom lpfc fc/fcoe scsi driver, scsi subsystem, the rest · Maintainers: Justin Tee, Paul Ely, "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds

Calls to lpfc_find_vport_by_vpid() for the highest indexed vport fails
with error, "2936 Could not find Vport mapped to vpi XXX".  Our vport
indices in the loop and if-clauses were off by one.

Correct the vpid range used for vpi lookup to include the
highest possible vpid.

Co-developed-by: Dick Kennedy <redacted>
Signed-off-by: Dick Kennedy <redacted>
Signed-off-by: James Smart <redacted>
---
 drivers/scsi/lpfc/lpfc_hbadisc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 48ca4a612f80..a60fa3f67076 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -6081,12 +6081,12 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
 		 * Translate the physical vpi to the logical vpi.  The
 		 * vport stores the logical vpi.
 		 */
-		for (i = 0; i < phba->max_vpi; i++) {
+		for (i = 0; i <= phba->max_vpi; i++) {
 			if (vpi == phba->vpi_ids[i])
 				break;
 		}
 
-		if (i >= phba->max_vpi) {
+		if (i > phba->max_vpi) {
 			lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
 					"2936 Could not find Vport mapped "
 					"to vpi %d\n", vpi);
-- 
2.26.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help