Skip to contentSkip to conversation

dc395x: uninitialized variable in device_alloc()

PATCH In review Dan Carpenter 2 participants 2 messages Feb 11, 2013 – Feb 13, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dc395x: uninitialized variable in device_alloc()

This bug was introduced back in bitkeeper days in 2003. We use "dcb->dev_mode" before it has been initialized.

drivers/scsi/dc395x.c +1 -1
index 865c64f..fed486bf 100644
@@ -3747,13 +3747,13 @@ static struct DeviceCtlBlk *device_alloc(struct AdapterCtlBlk *acb,
 	dcb->max_command = 1;
 	dcb->target_id = target;
 	dcb->target_lun = lun;
+	dcb->dev_mode = eeprom->target[target].cfg0;
 #ifndef DC395x_NO_DISCONNECT
 	dcb->identify_msg  	    IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun);
 #else
 	dcb->identify_msg = IDENTIFY(0, lun);
 #endif
-	dcb->dev_mode = eeprom->target[target].cfg0;
 	dcb->inquiry7 = 0;
 	dcb->sync_mode = 0;
 	dcb->min_nego_period = clock_period[period_index];