diff -Nur linux-2.4.28.org/drivers/scsi/dpt_i2o.c linux-2.4.28/drivers/scsi/dpt_i2o.c
--- linux-2.4.28.org/drivers/scsi/dpt_i2o.c	2004-11-17 20:54:21.000000000 +0900
+++ linux-2.4.28/drivers/scsi/dpt_i2o.c	2005-01-18 11:42:56.000000000 +0900

/*                  */
/* Problem Number 1 */
/*                  */
************************************************************************************
@@ -185,7 +185,8 @@
 			if(adpt_install_hba(sht, pDev) ){
 				PERROR("Could not Init an I2O RAID device\n");
 				PERROR("Will not try to detect others.\n");
-				return hba_count-1;
+				adpt_i2o_sys_shutdown();
+				return 0;
 			}
 		}
 	}
************************************************************************************

/*                  */
/* Problem Number 2 */
/*                  */
************************************************************************************
@@ -239,7 +240,11 @@
 			adpt_i2o_delete_hba(pHba);
 			continue;
 		}
-		adpt_inquiry(pHba);
+
+		if (adpt_inquiry(pHba) < 0) {
+			adpt_i2o_sys_shutdown();
+			return 0;
+		}
 	}
 
 	for (pHba = hba_chain; pHba; pHba = pHba->next) {
@@ -274,7 +279,7 @@
 }
 
 
-static void adpt_inquiry(adpt_hba* pHba)
+static int adpt_inquiry(adpt_hba* pHba)
 {
 	u32 msg[14]; 
 	u32 *mptr;
@@ -291,7 +296,7 @@
 	buf = (u8*)kmalloc(80,GFP_KERNEL|ADDR32);
 	if(!buf){
 		printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name);
-		return;
+		return -1;
 	}
 	memset((void*)buf, 0, 36);
 	
@@ -351,7 +356,7 @@
 	}
 	kfree(buf);
 	adpt_i2o_status_get(pHba);
-	return ;
+	return 0;
 }
************************************************************************************
 
/*                  */
/* Problem Number 3 */
/*                  */
************************************************************************************
@@ -578,6 +583,11 @@
 		for(id = 0; id < MAX_ID; id++) {
 			d = pHba->channel[chan].device[id];
 			while(d){
+				if (d->pScsi_dev == NULL) {
+					d = d->next_lun;
+					continue;
+				}
+
 				len += sprintf(buffer+len,"\t%-24.24s", d->pScsi_dev->vendor);
 				len += sprintf(buffer+len," Rev: %-8.8s\n", d->pScsi_dev->rev);
 				pos = begin + len;
************************************************************************************

/*                  */
/* Problem Number 4 */
/*                  */
************************************************************************************
@@ -933,6 +943,11 @@
 		}
 	}
 
+	if(i >= DPTI_MAX_HBA){
+		printk(KERN_ERR"Couldn't register for hbas[]\n");
+		return -EINVAL;
+	}
+
 	if(hba_chain != NULL){
 		for(p = hba_chain; p->next; p = p->next);
 		p->next = pHba;
************************************************************************************

/*                  */
/* Problem Number 5 */
/*                  */
************************************************************************************
@@ -1092,6 +1107,9 @@
 		return NULL;
 	}
 
+	if (id < 0 || id >= MAX_ID)
+		return NULL;
+
 	d = pHba->channel[chan].device[id];
 	if(!d || d->tid == 0) {
 		return NULL;
************************************************************************************

/*                  */
/* Problem Number 6 */
/*                  */
************************************************************************************
@@ -2410,6 +2428,14 @@
 			bus_no = buf[0]>>16;
 			scsi_id = buf[1];
 			scsi_lun = (buf[2]>>8 )&0xff;
+			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;
+			}
+			if(scsi_id >= MAX_ID) {
+				printk(KERN_WARNING"%s: Id number %d out of range \n", pHba->name, scsi_id);
+				continue;
+			}
 			pDev = pHba->channel[bus_no].device[scsi_id];
 			/* da lun */
 			while(pDev) {
@@ -2435,10 +2461,6 @@
 				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 =  kmalloc(sizeof(struct adpt_device),GFP_KERNEL);
************************************************************************************

/*                  */
/* Problem Number 7 */
/*                  */
************************************************************************************
@@ -2477,6 +2499,10 @@
 			// We found an old device - check it
 			while(pDev) {
 				if(pDev->scsi_lun == scsi_lun) {
+					if(pDev->pScsi_dev == NULL) {
+						pDev = pDev->next_lun;
+						continue;
+					}
 					if(pDev->pScsi_dev->online == FALSE) {
 						printk(KERN_WARNING"%s: Setting device (%d,%d,%d) back online\n",
 								pHba->name,bus_no,scsi_id,scsi_lun);
************************************************************************************

/*                  */
/* Problem Number 8 */
/*                  */
************************************************************************************
@@ -2931,6 +2957,8 @@
 		pHba->FwDebugStrLength_P = pHba->FwDebugBuffer_P + FW_DEBUG_STR_LENGTH_OFFSET;
 		pHba->FwDebugBuffer_P += buf[2]; 
 		pHba->FwDebugFlags = 0;
+	} else {
+		return -1;
 	}
 
 	return 0;
************************************************************************************

diff -Nur linux-2.4.28.org/drivers/scsi/dpti.h linux-2.4.28/drivers/scsi/dpti.h
--- linux-2.4.28.org/drivers/scsi/dpti.h	2001-09-08 01:28:38.000000000 +0900
+++ linux-2.4.28/drivers/scsi/dpti.h	2005-01-18 11:43:46.000000000 +0900

/*                  */
/* Problem Number 2 */
/*                  */
************************************************************************************
@@ -348,7 +348,7 @@
 static s32 adpt_send_nop(adpt_hba*pHba,u32 m);
 static void adpt_i2o_delete_hba(adpt_hba* pHba);
 static void adpt_select_queue_depths(struct Scsi_Host *host, Scsi_Device * devicelist);
-static void adpt_inquiry(adpt_hba* pHba);
+static int adpt_inquiry(adpt_hba* pHba);
 static void adpt_fail_posted_scbs(adpt_hba* pHba);
 static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun);
 static int adpt_install_hba(Scsi_Host_Template* sht, struct pci_dev* pDev) ;
************************************************************************************
