Skip to content

Commit

Permalink
[SCSI] dpt_i2o: move range check forward
Browse files Browse the repository at this point in the history
The check to test that "bus_no" was valid came after we had already used
it as an array offset.  This patch moves it forward.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Dan Carpenter authored and James Bottomley committed Jul 28, 2010
1 parent 32de596 commit e84d96d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/scsi/dpt_i2o.c
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,13 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
continue;
}
bus_no = buf[0]>>16;
if (bus_no >= MAX_CHANNEL) { /* Something wrong skip it */
printk(KERN_WARNING
"%s: Channel number %d out of range\n",
pHba->name, bus_no);
continue;
}

scsi_id = buf[1];
scsi_lun = (buf[2]>>8 )&0xff;
pDev = pHba->channel[bus_no].device[scsi_id];
Expand Down Expand Up @@ -2668,10 +2675,6 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
adpt_i2o_report_hba_unit(pHba, d);
adpt_i2o_install_device(pHba, d);

if(bus_no >= MAX_CHANNEL) { // Something wrong skip it
printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
continue;
}
pDev = pHba->channel[bus_no].device[scsi_id];
if( pDev == NULL){
pDev =
Expand Down

0 comments on commit e84d96d

Please sign in to comment.