public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lpfc: Read buffer overflow
@ 2009-08-02  8:08 Roel Kluin
  2009-08-03 15:02 ` James Smart
  0 siblings, 1 reply; 7+ messages in thread
From: Roel Kluin @ 2009-08-02  8:08 UTC (permalink / raw)
  To: james.smart, linux-scsi, Andrew Morton

Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index e0b4992..ade2df6 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -762,7 +762,7 @@ lpfc_destroy_vport_work_array(struct lpfc_hba *phba, struct lpfc_vport **vports)
 	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);
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-08-04 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02  8:08 [PATCH] lpfc: Read buffer overflow Roel Kluin
2009-08-03 15:02 ` James Smart
2009-08-03 17:15   ` Joe Eykholt
2009-08-04 13:29     ` James Smart
2009-08-03 23:42   ` Andrew Morton
2009-08-04  0:31     ` James Bottomley
2009-08-04 13:39       ` James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox