off by one in FlashPoint.c
Subsystems (2)
PATCH 1/1 off by one in FlashPoint.c
The check should be >= instead of > or we could go past the end of the array.
drivers/scsi/FlashPoint.c +1 -1
@@ -3924,7 +3924,7 @@ {struct sccb_mgr_tar_info *currTar_Info; -if ((p_sccb->TargID >MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) { +if ((p_sccb->TargID >=MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) {return ; } currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
Quoted 2 lines · Dan Carpenter
The check should be >= instead of > or we could go past the end of the array.
What about the LUN check? I'm not sure either way, but usually MAX LUN
is the max number of LUNs, not the max LU number, although that's been in flux lately.
Quoted 20 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/scsi/FlashPoint.c +1
-2@@ -3924,7 +3924,7 @@ {struct sccb_mgr_tar_info *currTar_Info; -if ((p_sccb->TargID >MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) { +if ((p_sccb->TargID >=MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) {return ; } currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Joe Eykholt
Quoted 2 lines · Dan Carpenter
The check should be >= instead of > or we could go past the end of the array.
What about the LUN check? I'm not sure either way, but usually MAX LUN
is the max number of LUNs, not the max LU number, although that's been in flux lately.
No no. You're clearly correct. That matches how MAX_LUN is used throughout the file.
Will send an updated patch.
regards,
dan carpenter
Quoted 19 lines
Quoted 19 lines
Signed-off-by Dan Carpenter <[email protected]>drivers/scsi/FlashPoint.c +1
-1@@ -3924,7 +3924,7 @@ {struct sccb_mgr_tar_info *currTar_Info; - if ((p_sccb->TargID > MAX_SCSI_TAR) || (p_sccb->Lun > MAX_LUN)) { +if ((p_sccb->TargID >=MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) {return ; } currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; --To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/1 off by one in FlashPoint.c (v2)
In reply to Joe EykholtThe check on MAX_SCSI_TAR should be >= instead of > or we could go past the end of the array.
Joe Eykholt aslo correctly points out that the check on MAX_LUN should be
Quoted 1 line
= as well. That matches with how it is used in the rest of the file.
drivers/scsi/FlashPoint.c +1 -1
@@ -3924,7 +3924,7 @@ static void FPT_sinits(struct sccb *p_sc {struct sccb_mgr_tar_info *currTar_Info; -if ((p_sccb->TargID >MAX_SCSI_TAR ) || (p_sccb->Lun >MAX_LUN )) { +if ((p_sccb->TargID >=MAX_SCSI_TAR ) || (p_sccb->Lun >=MAX_LUN )) {return ; } currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];