diff options
author | Dan Carpenter <error27@gmail.com> | 2010-07-15 10:20:19 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 09:05:43 -0500 |
commit | e84d96dbb0638186feb526c32810a3400f33d0c8 (patch) | |
tree | f9c17031c91040214cbe3ea745aa53d10602d340 /drivers/scsi/dpt_i2o.c | |
parent | 32de596074592ee8593416c83347b5a787e825c5 (diff) | |
download | kernel_goldelico_gta04-e84d96dbb0638186feb526c32810a3400f33d0c8.zip kernel_goldelico_gta04-e84d96dbb0638186feb526c32810a3400f33d0c8.tar.gz kernel_goldelico_gta04-e84d96dbb0638186feb526c32810a3400f33d0c8.tar.bz2 |
[SCSI] dpt_i2o: move range check forward
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>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index f2d4df1..ffc1edf 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -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]; @@ -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 = |