public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] off by one in FlashPoint.c
@ 2009-12-27 13:14 Dan Carpenter
  2009-12-28 17:14 ` Joe Eykholt
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2009-12-27 13:14 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi

The check should be >= instead of > or we could go past the end of the
array.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/drivers/scsi/FlashPoint.c	2009-12-27 11:35:58.000000000 +0200
+++ devel/drivers/scsi/FlashPoint.c	2009-12-27 11:36:19.000000000 +0200
@@ -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];



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

* Re: [patch] off by one in FlashPoint.c
  2009-12-27 13:14 [patch] off by one in FlashPoint.c Dan Carpenter
@ 2009-12-28 17:14 ` Joe Eykholt
  2009-12-28 18:03   ` Dan Carpenter
  2009-12-28 18:08   ` [patch] off by one in FlashPoint.c (v2) Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Joe Eykholt @ 2009-12-28 17:14 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: James E.J. Bottomley, linux-scsi



Dan Carpenter wrote:
> 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.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> --- orig/drivers/scsi/FlashPoint.c	2009-12-27 11:35:58.000000000 +0200
> +++ devel/drivers/scsi/FlashPoint.c	2009-12-27 11:36:19.000000000 +0200
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] off by one in FlashPoint.c
  2009-12-28 17:14 ` Joe Eykholt
@ 2009-12-28 18:03   ` Dan Carpenter
  2009-12-28 18:08   ` [patch] off by one in FlashPoint.c (v2) Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2009-12-28 18:03 UTC (permalink / raw)
  To: Joe Eykholt; +Cc: James E.J. Bottomley, linux-scsi

On Mon, Dec 28, 2009 at 12:14:39PM -0500, Joe Eykholt wrote:
>
>
> Dan Carpenter wrote:
>> 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

>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>>
>> --- orig/drivers/scsi/FlashPoint.c	2009-12-27 11:35:58.000000000 +0200
>> +++ devel/drivers/scsi/FlashPoint.c	2009-12-27 11:36:19.000000000 +0200
>> @@ -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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [patch] off by one in FlashPoint.c (v2)
  2009-12-28 17:14 ` Joe Eykholt
  2009-12-28 18:03   ` Dan Carpenter
@ 2009-12-28 18:08   ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2009-12-28 18:08 UTC (permalink / raw)
  To: Joe Eykholt; +Cc: James E.J. Bottomley, linux-scsi

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>

--- orig/drivers/scsi/FlashPoint.c	2009-12-27 11:35:58.000000000 +0200
+++ devel/drivers/scsi/FlashPoint.c	2009-12-28 19:59:33.000000000 +0200
@@ -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];

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

end of thread, other threads:[~2009-12-28 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-27 13:14 [patch] off by one in FlashPoint.c Dan Carpenter
2009-12-28 17:14 ` Joe Eykholt
2009-12-28 18:03   ` Dan Carpenter
2009-12-28 18:08   ` [patch] off by one in FlashPoint.c (v2) Dan Carpenter

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