aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 6085f5ef88ea..808bd62e1723 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -372,9 +372,6 @@ static bool check_symbol(const struct symsearch *syms,
372 printk(KERN_WARNING "Symbol %s is being used " 372 printk(KERN_WARNING "Symbol %s is being used "
373 "by a non-GPL module, which will not " 373 "by a non-GPL module, which will not "
374 "be allowed in the future\n", fsa->name); 374 "be allowed in the future\n", fsa->name);
375 printk(KERN_WARNING "Please see the file "
376 "Documentation/feature-removal-schedule.txt "
377 "in the kernel source tree for more details.\n");
378 } 375 }
379 } 376 }
380 377
@@ -2293,12 +2290,17 @@ static void layout_symtab(struct module *mod, struct load_info *info)
2293 src = (void *)info->hdr + symsect->sh_offset; 2290 src = (void *)info->hdr + symsect->sh_offset;
2294 nsrc = symsect->sh_size / sizeof(*src); 2291 nsrc = symsect->sh_size / sizeof(*src);
2295 2292
2293 /* strtab always starts with a nul, so offset 0 is the empty string. */
2294 strtab_size = 1;
2295
2296 /* Compute total space required for the core symbols' strtab. */ 2296 /* Compute total space required for the core symbols' strtab. */
2297 for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src) 2297 for (ndst = i = 0; i < nsrc; i++) {
2298 if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) { 2298 if (i == 0 ||
2299 strtab_size += strlen(&info->strtab[src->st_name]) + 1; 2299 is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
2300 strtab_size += strlen(&info->strtab[src[i].st_name])+1;
2300 ndst++; 2301 ndst++;
2301 } 2302 }
2303 }
2302 2304
2303 /* Append room for core symbols at end of core part. */ 2305 /* Append room for core symbols at end of core part. */
2304 info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1); 2306 info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1);
@@ -2332,15 +2334,15 @@ static void add_kallsyms(struct module *mod, const struct load_info *info)
2332 mod->core_symtab = dst = mod->module_core + info->symoffs; 2334 mod->core_symtab = dst = mod->module_core + info->symoffs;
2333 mod->core_strtab = s = mod->module_core + info->stroffs; 2335 mod->core_strtab = s = mod->module_core + info->stroffs;
2334 src = mod->symtab; 2336 src = mod->symtab;
2335 *dst = *src;
2336 *s++ = 0; 2337 *s++ = 0;
2337 for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) { 2338 for (ndst = i = 0; i < mod->num_symtab; i++) {
2338 if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) 2339 if (i == 0 ||
2339 continue; 2340 is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
2340 2341 dst[ndst] = src[i];
2341 dst[ndst] = *src; 2342 dst[ndst++].st_name = s - mod->core_strtab;
2342 dst[ndst++].st_name = s - mod->core_strtab; 2343 s += strlcpy(s, &mod->strtab[src[i].st_name],
2343 s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1; 2344 KSYM_NAME_LEN) + 1;
2345 }
2344 } 2346 }
2345 mod->core_num_syms = ndst; 2347 mod->core_num_syms = ndst;
2346} 2348}