Oops in do_mounts.c file.
Hello all,
I am getting an oops in the mount_root function if I pass root=/dev/nfs to my 2.5.1 kernel.
I am also getting an oops in the mount_block_root function if I pass root=/dev/hda3 to my 2.5.1 kernel.
The problem appears to be related to the following two lines in the init/do_mounts.c file:
static char * __initdata root_mount_data;
static char * __initdata root_fs_names;
The __initdata macro appears to be incorrectly used.
In include/linux/init.h the explanation for the macro says the __initdata should appear after the variable name. It also indicates that the variable shoud be initialized.
The attached patch fixes the problem.
-- Dan A.
Index: do_mounts.c
===================================================================
RCS file: /cvs/linux/init/do_mounts.c,v
retrieving revision 1.1
do_mounts.c +2 -2
@@ -239,14 +239,14 @@__setup ("root=" , root_dev_setup); -static char *__initdata root_mount_data; +static char * root_mount_data__initdata =NULL ;static int __init root_data_setup (char *str) { root_mount_data = str;return 1 ; } -static char *__initdata root_fs_names; +static char * root_fs_names__initdata =NULL ;static int __init fs_names_setup (char *str) { root_fs_names = str;
Quoted 11 lines · Dan Aizenstros
I am getting an oops in the
mount_rootfunction if I pass root=/dev/nfs to my 2.5.1 kernel.I am also getting an oops in the
mount_block_rootfunction if I pass root=/dev/hda3 to my 2.5.1 kernel.The problem appears to be related to the following two lines in the
init/do_mounts.cfile:static char *
__initdataroot_mount_data;
Quoted 8 lines
static char *
__initdataroot_fs_names;The
__initdatamacro appears to be incorrectly used.In
include/linux/init.hthe explanation for the macro says the__initdatashould appear after the variable name. It also indicates that the variable shoud be initialized.
Old gcc was more restrictive about the position of __attribute__() than current gccs. The comment documents older gcc. Old in this context means older than egcs 1.1.2 which is currently the required minmum version to compile the kernel.
Quoted 1 line
The attached patch fixes the problem.
And that's highly suspect. No matter with or without your patch root_mount_data and root_fs_names should endup in .data.init. So if your patch indeed has an effect that your compiler seems is suspect.
Can you try to look at the generated assembler source and object files and check into which sections gcc places these variables?
Ralf