From: "Juan M. de la Torre" <jmtorre@gmx.net>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sys_init_module refuses to load module without init code/data sections
Date: Tue, 19 Nov 2002 20:38:57 +0100 [thread overview]
Message-ID: <20021119193857.GA406@apocalipsis> (raw)
load_module() stores in mod->init_size the size of init data and init
code sections, and later allocs (using module_alloc()) mod->init_size
bytes.
If the module has not init data and init code sections mod->init_size
is 0, so module_alloc() will return NULL and load_module() will abort
loading the module with -ENOMEM.
Possible patch attached, sorry if this is a known issue.
Best regards,
Juanma
--- linux-2.5.48/kernel/module.c.orig Tue Nov 19 20:08:52 2002
+++ linux-2.5.48/kernel/module.c Tue Nov 19 20:37:47 2002
@@ -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. */
--
/jm
next reply other threads:[~2002-11-19 19:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-19 19:38 Juan M. de la Torre [this message]
2002-11-20 7:35 ` [PATCH] sys_init_module refuses to load module without init code/data sections Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021119193857.GA406@apocalipsis \
--to=jmtorre@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox