From: Carl-Daniel Hailfinger <c-d.hailfinger.kernel.2004@gmx.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics
Date: Sat, 31 Jan 2004 13:52:48 +0100 [thread overview]
Message-ID: <401BA520.7070204@gmx.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
Linus,
Rusty,
while studying the module code closely, I found a problem in
kernel/module.c:153ff.
for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++)
In combination with __start___ksymtab[i].name this will go eight times too
far. Proposed fix is attached.
Please apply before 2.6.2. If you think this makes the code too slow, I
can offer an alternative which will even speed up the current code.
Thanks,
Carl-Daniel
[-- Attachment #2: modulefix.txt --]
[-- Type: text/plain, Size: 1132 bytes --]
===== kernel/module.c 1.99 vs edited =====
--- 1.99/kernel/module.c Wed Jan 21 02:50:58 2004
+++ edited/kernel/module.c Sat Jan 31 13:50:47 2004
@@ -150,14 +150,14 @@
/* Core kernel first. */
*owner = NULL;
- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) {
+ for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++) {
if (strcmp(__start___ksymtab[i].name, name) == 0) {
*crc = symversion(__start___kcrctab, i);
return __start___ksymtab[i].value;
}
}
if (gplok) {
- for (i = 0; __start___ksymtab_gpl+i<__stop___ksymtab_gpl; i++)
+ for (i = 0; __start___ksymtab_gpl+i*sizeof(struct kernel_symbol) < __stop___ksymtab_gpl; i++)
if (strcmp(__start___ksymtab_gpl[i].name, name) == 0) {
*crc = symversion(__start___kcrctab_gpl, i);
return __start___ksymtab_gpl[i].value;
@@ -1308,7 +1308,7 @@
unsigned int i;
if (!mod) {
- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++)
+ for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++)
if (strcmp(__start___ksymtab[i].name, name) == 0)
return 1;
return 0;
next reply other threads:[~2004-01-31 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-31 12:52 Carl-Daniel Hailfinger [this message]
2004-01-31 13:55 ` [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics Rusty Russell
2004-01-31 16:35 ` Carl-Daniel Hailfinger
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=401BA520.7070204@gmx.net \
--to=c-d.hailfinger.kernel.2004@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@osdl.org \
/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