This is a followup to my previous post regarding the kernel Oops I was
having in 2.0.3X when loading modules with a codesize on PAGE_SIZE
boundaries.
The following patch seems to make the problem go away. Can a knowledgeable
kernel hacker please comment on whether this is the right solution, or if
my problem lies elsewhere?
--- kernel/module.c.orig Tue Jan 19 13:41:30 1999
+++ kernel/module.c Tue Jan 19 13:43:23 1999
@@ -101,7 +101,7 @@
}
strcpy((char *)(mp + 1), name); /* why not? */
- npages = (size + sizeof (long) + PAGE_SIZE - 1) / PAGE_SIZE;
+ npages = ((size + sizeof (long)) / PAGE_SIZE) + 1;
if ((addr = vmalloc(npages * PAGE_SIZE)) == 0) {
kfree_s(mp, sspace);
return -ENOMEM;
@@ -166,7 +166,8 @@
}
if ((codesize + sizeof (long) + PAGE_SIZE - 1) / PAGE_SIZE >
mp->size)
return -EINVAL;
- memcpy_fromfs((char *)mp->addr + sizeof (long), code, codesize);
+ memcpy_fromfs((char *)mp->addr + sizeof (long), code,
+ codesize - sizeof (long));
memset((char *)mp->addr + sizeof (long) + codesize, 0,
mp->size * PAGE_SIZE - (codesize + sizeof (long)));
pr_debug("module init entry = 0x%08lx, cleanup entry = 0x%08lx\n",
thanks,
-bp
-- B. James Phillippe . bryan@terran.org Linux Engineer/Admin . http://www.terran.org/~bryan Member since 1.1.59 . finger:bryan@earth.terran.org
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/