[2.6 patch] scsi/FlashPoint.c: fix off-by-one errors

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Adrian Bunk
Date: Wednesday, April 23, 2008 - 2:51 am

This patch fixes off-by-one errors in error checks (the variables are 
used as array indexes for arrays with MAX_SCSI_TAR resp. MAX_LUN 
elements) spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
02fc526feb4e67cfb0008e04f5b797e8315b9cd4 diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index b374e45..b898d38 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -1499,7 +1499,7 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb)
 	thisCard = ((struct sccb_card *)pCurrCard)->cardIndex;
 	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
 
-	if ((p_Sccb->TargID > MAX_SCSI_TAR) || (p_Sccb->Lun > MAX_LUN)) {
+	if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) {
 
 		p_Sccb->HostStatus = SCCB_COMPLETE;
 		p_Sccb->SccbStatus = SCCB_ERROR;

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[2.6 patch] scsi/FlashPoint.c: fix off-by-one errors, Adrian Bunk, (Wed Apr 23, 2:51 am)