Skip to contentSkip to conversation

Can't allocate memory when loading a module 2.5.48-bk

DISCUSSION Greg KH 4 participants 4 messages Nov 20, 2002 – Nov 25, 2002

lore
Share & tools
lore

Greg KH

author
#0 lore raw

With Linus's latest bk tree (plus some USB patches) I get the following error when trying to load the parport.o module:

# modprobe parport
FATAL: Error inserting /lib/modules/2.5.48/kernel/parport.o: Cannot allocate memory

Any ideas?

thanks,

greg k-h

#1 lore raw
Quoted 7 lines · Greg KH

With Linus's latest bk tree (plus some USB patches) I get the following error when trying to load the parport.o module:

# modprobe parport
FATAL: Error inserting /lib/modules/2.5.48/kernel/parport.o: Cannot allocate memory

Any ideas?

Tag some init code with __init

At least stock 2.5.48 tries to happily allocate zero bytes for init section, and gets a null pointer. That 'error' is then propagated to user space.

Regards,
Jari Ruusu <[email protected]>

#2 lore raw
In reply to Greg KH
Quoted 7 lines · Greg KH

With Linus's latest bk tree (plus some USB patches) I get the following error when trying to load the parport.o module:

# modprobe parport
FATAL: Error inserting /lib/modules/2.5.48/kernel/parport.o: Cannot allocate memory

Any ideas?

Try applying this patch:

kernel/module.c Tue Nov 19 20:37:47 2002 renamed from kernel/module.c.orig Tue Nov 19 20:08:52 2002 +9 -7
@@ -972,13 +972,15 @@
        memset(ptr, 0, mod->core_size);
        mod->module_core = ptr;
 
-       ptr = module_alloc(mod->init_size);
-       if (!ptr) {
-               err = -ENOMEM;
-               goto free_core;
-       }
-       memset(ptr, 0, mod->init_size);
-       mod->module_init = ptr;
+       if (mod->init_size) {
+               ptr = module_alloc(mod->init_size);
+               if (!ptr) {
+                       err = -ENOMEM;
+                       goto free_core;
+               }
+               memset(ptr, 0, mod->init_size);
+               mod->module_init = ptr;
+       }
 
        /* Transfer each section which requires ALLOC, and set sh_offset
           fields to absolute addresses. */
Signature · 1 line
/jm
#3 lore raw
In reply to Greg KH

In message <[email protected]> you write:

Quoted 5 lines

With Linus's latest bk tree (plus some USB patches) I get the following error when trying to load the parport.o module:

# modprobe parport
FATAL: Error inserting /lib/modules/2.5.48/kernel/parport.o: Cannot allocate 

memory

Quoted 2 lines

Any ideas?

No init section, my bad. Should be fixed in 49.

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.