Skip to contentSkip to conversation

fix "no member named 'sect_attrs' of strcut module"

PATCH In review Wu Zhangjin 2 participants 2 messages Sep 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix "no member named 'sect_attrs' of strcut module"

From: Wu Zhangjin <[email protected]>

The commit(1b364bf438cf337a3818aee77d68c0713f3e1fc4, "module: workaround duplicate section names") introduced a condition to avoid null pointer reference:

- add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
+ if (mod->sect_attrs)
+ add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);

but sect_attrs is only defined when CONFIG_KALLSYMS enabled, so this patch is need to fix the following error:

error: 'struct module' has no member named 'sect_attrs'

---
 kernel/module.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/module.c +2 -0
index eccb561..b4016d1 100644
@@ -2355,8 +2355,10 @@ static noinline struct module *load_module(void __user *umod,
 	if (err < 0)
 		goto unlink;
 	add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
+#ifdef CONFIG_KALLSYMS
 	if (mod->sect_attrs)
 		add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
+#endif
 
 	/* Get rid of temporary copy */
 	vfree(hdr);
Signature · 1 line
1.6.2.1
#1 lore raw
Quoted 10 lines · Wu Zhangjin

From: Wu Zhangjin <[email protected]>

The commit(1b364bf438cf337a3818aee77d68c0713f3e1fc4, "module: workaround duplicate section names") introduced a condition to avoid null pointer reference:

(quoted diff) +2 -1
-       add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
+       if (mod->sect_attrs)
+               add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
Quoted 6 lines

but sect_attrs is only defined when CONFIG_KALLSYMS enabled, so this patch is need to fix the following error:

error: 'struct module' has no member named 'sect_attrs'

This has been fixed already, see this upstream fix:

ea6bff3: modules: Fix build error in the !CONFIG_KALLSYMS case

Ingo