ide-tape.c::idetape_init() issues

James Manning jmm en raleigh.ibm.com
Jue Ene 20 08:28:38 CST 2000


While compiling 2.3.40-pre6:

ide-tape.c: In function `idetape_init':
ide-tape.c:5854: warning: `tape' might be used uninitialized in this function

Sure enough, it looks like at line 5869 tape->debug_level
is referenced without tape ever being set to a valid memory address.

At first I thought the "right" answer was to just point to drive->driver_data
as is done in other parts of the program:

--- linux-2.3.40-6/drivers/block/ide-tape.c	Thu Jan 20 00:44:12 2000
+++ linux/drivers/block/ide-tape.c	Thu Jan 20 01:16:47 2000
@@ -5866,6 +5866,7 @@
 		ide_register_module (&idetape_module);
 		MOD_DEC_USE_COUNT;
 #if ONSTREAM_DEBUG
+		tape = drive->driver_data;
 		if (tape->debug_level >= 6)
 			printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_init\n");
 #endif

But now I'm unclear about this because of how tape is setup later on
during the idetape_setup() call (idetape_init was hard for me to follow)

In either case it does appear that as it stands, if ONSTREAM_DEBUG
is turned on (which it is by default) and the ide_scan_devices
returns NULL, you'll dereference an invalid pointer.

James
-- 
Miscellaneous Engineer --- IBM Netfinity Performance Development

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



Más información sobre la lista de distribución Ayuda