modules: Fix build error in the !CONFIG_KALLSYMS case

> James Bottomley (1):
> module: workaround duplicate section names

-tip testing found that this patch breaks the build on x86 if
CONFIG_KALLSYMS is disabled:

kernel/module.c: In function ‘load_module’:
kernel/module.c:2367: error: ‘struct module’ has no member named ‘sect_attrs’
distcc[8269] ERROR: compile kernel/module.c on ph/32 failed
make[1]: *** [kernel/module.o] Error 1
make: *** [kernel] Error 2
make: *** Waiting for unfinished jobs....

Commit 1b364bf misses the fact that section attributes are only
built and dealt with if kallsyms is enabled. The patch below fixes
this.

( note, technically speaking this should depend on CONFIG_SYSFS as
well but this patch is correct too and keeps the #ifdef less
intrusive - in the KALLSYMS && !SYSFS case the code is a NOP. )

Signed-off-by: Ingo Molnar <mingo@elte.hu>
[ Replaced patch with a slightly cleaner variation by James Bottomley ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Ingo Molnar and committed by Linus Torvalds ea6bff36 4ed86af6

+5 -2
+5 -2
kernel/module.c
··· 1274 struct module_notes_attrs *notes_attrs; 1275 struct bin_attribute *nattr; 1276 1277 /* Count notes sections and allocate structures. */ 1278 notes = 0; 1279 for (i = 0; i < nsect; i++) ··· 2359 if (err < 0) 2360 goto unlink; 2361 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2362 - if (mod->sect_attrs) 2363 - add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2364 2365 /* Get rid of temporary copy */ 2366 vfree(hdr);
··· 1274 struct module_notes_attrs *notes_attrs; 1275 struct bin_attribute *nattr; 1276 1277 + /* failed to create section attributes, so can't create notes */ 1278 + if (!mod->sect_attrs) 1279 + return; 1280 + 1281 /* Count notes sections and allocate structures. */ 1282 notes = 0; 1283 for (i = 0; i < nsect; i++) ··· 2355 if (err < 0) 2356 goto unlink; 2357 add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2358 + add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs); 2359 2360 /* Get rid of temporary copy */ 2361 vfree(hdr);