On Thu, Apr 19 2001, Stefan Jaschke wrote:
> Hi Jens,
> 
> I applied your patch to 2.4.4-pre4. It compiled fine, but crashed during
> boot (just right after the IDE init) with
> -------------------
> Uniform CD-ROM driver Revision: 3.12
> Unable to handle kernel NULL pointer dereference at virtual address 00000000
> printing eip: ...
> Oops: 0000
> ...
> -------------------

This should fix it.

-- 
Jens Axboe

--- drivers/cdrom/cdrom.c~      Thu Apr 19 13:44:46 2001
+++ drivers/cdrom/cdrom.c       Thu Apr 19 13:45:33 2001
@@ -350,6 +350,12 @@
 {
        int i, nr, foo;
 
+       if (!cdrom_numbers) {
+               int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
+               cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
+               memset(cdrom_numbers, 0, n_entries * sizeof(unsigned long));
+       }
+
        nr = 0;
        foo = -1;
        for (i = 0; i < CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8); i++) {
@@ -2696,10 +2702,6 @@
 
 static int __init cdrom_init(void)
 {
-       int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
-
-       cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
-
 #ifdef CONFIG_SYSCTL
        cdrom_sysctl_register();
 #endif

Reply via email to