Skip to content

Commit 3a611c3

Browse files
committed
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: kbuild test robot <[email protected]> Based-on-the-true-story-by: Steven Rostedt <[email protected]> Confirms-rustys-story-ends-the-same-by: Steven Rostedt <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
1 parent 15ba223 commit 3a611c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/linux/moduleloader.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
4545
unsigned int relsec,
4646
struct module *me)
4747
{
48-
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
48+
printk(KERN_ERR "module %s: REL relocation unsupported\n",
49+
module_name(me));
4950
return -ENOEXEC;
5051
}
5152
#endif
@@ -67,7 +68,8 @@ static inline int apply_relocate_add(Elf_Shdr *sechdrs,
6768
unsigned int relsec,
6869
struct module *me)
6970
{
70-
printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
71+
printk(KERN_ERR "module %s: REL relocation unsupported\n",
72+
module_name(me));
7173
return -ENOEXEC;
7274
}
7375
#endif

0 commit comments

Comments
 (0)