diff options
Diffstat (limited to 'kernel/module.c')
| -rw-r--r-- | kernel/module.c | 30 | 
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,  			printk(KERN_WARNING "Symbol %s is being used "  			       "by a non-GPL module, which will not "  			       "be allowed in the future\n", fsa->name); -			printk(KERN_WARNING "Please see the file " -			       "Documentation/feature-removal-schedule.txt " -			       "in the kernel source tree for more details.\n");  		}  	} @@ -2293,12 +2290,17 @@ static void layout_symtab(struct module *mod, struct load_info *info)  	src = (void *)info->hdr + symsect->sh_offset;  	nsrc = symsect->sh_size / sizeof(*src); +	/* strtab always starts with a nul, so offset 0 is the empty string. */ +	strtab_size = 1; +  	/* Compute total space required for the core symbols' strtab. */ -	for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src) -		if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) { -			strtab_size += strlen(&info->strtab[src->st_name]) + 1; +	for (ndst = i = 0; i < nsrc; i++) { +		if (i == 0 || +		    is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { +			strtab_size += strlen(&info->strtab[src[i].st_name])+1;  			ndst++;  		} +	}  	/* Append room for core symbols at end of core part. */  	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)  	mod->core_symtab = dst = mod->module_core + info->symoffs;  	mod->core_strtab = s = mod->module_core + info->stroffs;  	src = mod->symtab; -	*dst = *src;  	*s++ = 0; -	for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) { -		if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) -			continue; - -		dst[ndst] = *src; -		dst[ndst++].st_name = s - mod->core_strtab; -		s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1; +	for (ndst = i = 0; i < mod->num_symtab; i++) { +		if (i == 0 || +		    is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { +			dst[ndst] = src[i]; +			dst[ndst++].st_name = s - mod->core_strtab; +			s += strlcpy(s, &mod->strtab[src[i].st_name], +				     KSYM_NAME_LEN) + 1; +		}  	}  	mod->core_num_syms = ndst;  } |