Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] FlashPoint: fix off by one tests

The 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
>= as well. That matches with how it is used in the rest of the file.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by

Dan Carpenter and committed by
James Bottomley
5d7ebb9c 0ed8570e

+1 -1
+1 -1
drivers/scsi/FlashPoint.c
··· 3924 3924 { 3925 3925 struct sccb_mgr_tar_info *currTar_Info; 3926 3926 3927 - if ((p_sccb->TargID > MAX_SCSI_TAR) || (p_sccb->Lun > MAX_LUN)) { 3927 + if ((p_sccb->TargID >= MAX_SCSI_TAR) || (p_sccb->Lun >= MAX_LUN)) { 3928 3928 return; 3929 3929 } 3930 3930 currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];