@@ -212,12 +212,13 @@ static inline void kmemleak_load_module(const struct module *mod,
const struct load_info *info) { }
#endif /* CONFIG_DEBUG_KMEMLEAK */
-#ifdef CONFIG_KALLSYMS
-#ifdef CONFIG_STACKTRACE_BUILD_ID
+#if defined(CONFIG_KALLSYMS) && defined(CONFIG_STACKTRACE_BUILD_ID)
void init_build_id(struct module *mod, const struct load_info *info);
-#else /* !CONFIG_STACKTRACE_BUILD_ID */
+#else
static inline void init_build_id(struct module *mod, const struct load_info *info) { }
#endif
+
+#ifdef CONFIG_KALLSYMS
void layout_symtab(struct module *mod, struct load_info *info);
void add_kallsyms(struct module *mod, const struct load_info *info);
unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name);
@@ -171,8 +171,7 @@ void add_kallsyms(struct module *mod, const struct load_info *info)
Elf_Shdr *symsec = &info->sechdrs[info->index.sym];
/* Set up to point into init section. */
- mod->kallsyms = (struct mod_kallsyms __rcu *)mod->init_layout.base +
- info->mod_kallsyms_init_off;
+ mod->kallsyms = (void __rcu *)mod->init_layout.base + info->mod_kallsyms_init_off;
/* The following is safe since this pointer cannot change */
rcu_dereference_sched(mod->kallsyms)->symtab = (void *)symsec->sh_addr;
Fixes: 54f2273e5fef ("module: Move kallsyms support into a separate file") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- kernel/module/internal.h | 7 ++++--- kernel/module/kallsyms.c | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-)