Commit 3a611c3c authored by Rusty Russell's avatar Rusty Russell

modules: Fix build error in moduleloader.h

Fengguang Wu's build bot detected that if moduleloader.h is included in
a C file (used by ftrace and kprobes to access module_alloc() when
available), that it can fail to build if CONFIG_MODULES and
CONFIG_MODULES_USE_ELF_REL is not defined.

This is because there's a printk() that dereferences struct module to
print the name of the module. But as struct module does not exist when
CONFIG_MODULES is not defined we get this error:

   include/linux/moduleloader.h: In function 'apply_relocate':
>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to
>> incomplete type
     printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
								  ^
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Based-on-the-true-story-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Confirms-rustys-story-ends-the-same-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 15ba2236
...@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs, ...@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
unsigned int relsec, unsigned int relsec,
struct module *me) struct module *me)
{ {
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); printk(KERN_ERR "module %s: REL relocation unsupported\n",
module_name(me));
return -ENOEXEC; return -ENOEXEC;
} }
#endif #endif
...@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs, ...@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
unsigned int relsec, unsigned int relsec,
struct module *me) struct module *me)
{ {
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name); printk(KERN_ERR "module %s: REL relocation unsupported\n",
module_name(me));
return -ENOEXEC; return -ENOEXEC;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment