From: Adrian Bunk Date: Wed, 23 Apr 2008 09:51:10 +0000 (+0300) Subject: [SCSI] FlashPoint: fix off-by-one errors X-Git-Tag: v2.6.26-rc1~1027^2~22 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1377d8dd7e1b5526637958aabb5427bbee5a68d7;p=linux-2.6 [SCSI] FlashPoint: fix off-by-one errors 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 Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index b374e457e5..b898d382b7 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;