[PATCH] Fix for Oops on boot

Jason Gunthorpe (jgg@ualberta.ca)
Tue, 27 Jul 1999 10:18:15 -0600 (MDT)


Hi,

If you compile a kernel with no block device support and try to boot it
with a root=/dev/xxx command line it will silently oops on boot when it
attempts to parse it. To fix this the do/while loop in
init/main.c:name_to_kdev_t should be changed to a while loop, thus
preventing it from dereferencing NULL on the first iteration. This only
occures if the root_dev_names table is completely empty.

This is particularly important if you are using the devfs patch or direct
major/minor numbers to locate the root device (as I am doing) - and it
prevents a very difficult to find oops..

--- init/main.c.org Tue Jul 27 10:13:55 1999
+++ init/main.c Tue Jul 27 10:14:22 1999
@@ -521,7 +521,7 @@
if (strncmp(line,"/dev/",5) == 0) {
struct dev_name_struct *dev = root_dev_names;
line += 5;
- do {
+ while (dev->name) {
int len = strlen(dev->name);
if (strncmp(line,dev->name,len) == 0) {
line += len;
@@ -529,7 +529,7 @@
break;
}
dev++;
- } while (dev->name);
+ }
}
return to_kdev_t(base + simple_strtoul(line,NULL,base?10:16));
}

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