* [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics
@ 2004-01-31 12:52 Carl-Daniel Hailfinger
2004-01-31 13:55 ` Rusty Russell
0 siblings, 1 reply; 3+ messages in thread
From: Carl-Daniel Hailfinger @ 2004-01-31 12:52 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Rusty Russell, Linux Kernel Mailing List
[-- 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;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics
2004-01-31 12:52 [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics Carl-Daniel Hailfinger
@ 2004-01-31 13:55 ` Rusty Russell
2004-01-31 16:35 ` Carl-Daniel Hailfinger
0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2004-01-31 13:55 UTC (permalink / raw)
To: Carl-Daniel Hailfinger; +Cc: Linus Torvalds, Linux Kernel Mailing List
In message <401BA520.7070204@gmx.net> you write:
> - for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) {
> + for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++) {
Above in this file, there is the declaration:
extern const struct kernel_symbol __start___ksymtab[];
What makes you think you need to multiply here?
Puzzled,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics
2004-01-31 13:55 ` Rusty Russell
@ 2004-01-31 16:35 ` Carl-Daniel Hailfinger
0 siblings, 0 replies; 3+ messages in thread
From: Carl-Daniel Hailfinger @ 2004-01-31 16:35 UTC (permalink / raw)
To: Rusty Russell; +Cc: Linus Torvalds, Linux Kernel Mailing List
Rusty Russell wrote:
> In message <401BA520.7070204@gmx.net> you write:
>
>>- for (i = 0; __start___ksymtab+i < __stop___ksymtab; i++) {
>>+ for (i = 0; __start___ksymtab+i*sizeof(struct kernel_symbol) < __stop___ksymtab; i++) {
>
>
> Above in this file, there is the declaration:
>
> extern const struct kernel_symbol __start___ksymtab[];
>
> What makes you think you need to multiply here?
-ENOCAFFEINE. (Note to self: Never send patches while asleep)
Now that I'm awake again, I feel ashamed.
> Puzzled,
> Rusty.
Sorry for the confusion,
Carl-Daniel.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-31 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-31 12:52 [PATCH] [2.6.2-rc3] Fix module.c pointer arithmetics Carl-Daniel Hailfinger
2004-01-31 13:55 ` Rusty Russell
2004-01-31 16:35 ` Carl-Daniel Hailfinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox