Skip to contentSkip to conversation

drivers/scsi/lpfc/lpfc_vport.c: fix read buffer overflow

PATCH In review [email protected] 1 participant 1 message May 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/26 drivers/scsi/lpfc/lpfc_vport.c: fix read buffer overflow

From: Roel Kluin <[email protected]>

Check whether index is within bounds before testing the element.

Cc James Smart <[email protected]>
Cc Joe Eykholt <[email protected]>
Cc James Bottomley <[email protected]>

---

 drivers/scsi/lpfc/lpfc_vport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_vport.c renamed from drivers/scsi/lpfc/lpfc_vport.c~drivers-scsi-lpfc-lpfc_vportc-fix-read-buffer-overflow +1 -1
diff -puN drivers/scsi/lpfc/lpfc_vport.c~drivers-scsi-lpfc-lpfc_vportc-fix-read-buffer-overflow drivers/scsi/lpfc/lpfc_vport.c
@@ -782,7 +782,7 @@ lpfc_destroy_vport_work_array(struct lpf
 	int i;
 	if (vports == NULL)
 		return;
-	for (i = 0; vports[i] != NULL && i <= phba->max_vports; i++)
+	for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++)
 		scsi_host_put(lpfc_shost_from_vport(vports[i]));
 	kfree(vports);
 }

_