From 797886bf130a8721934bb4464464797e759da52b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 1 Apr 2003 18:52:17 -0800 Subject: [PATCH] Fix naming confusion: number of symbol kallsyms is "num_kallsyms", while number of symbols is "num_syms". It used to be "num_syms" and "num_ksyms" respectively (ie the "k" was the wrong way around). The previous naming was not just confusing, it had caused one actual bug (ie the normal symbol code had used "num_syms", which was wrong in the old confusing naming scheme). --- include/linux/module.h | 4 ++-- kernel/module.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 57918bfaba256..6e01f8a3d77ff 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -183,7 +183,7 @@ struct module /* Exported symbols */ const struct kernel_symbol *syms; - unsigned int num_ksyms; + unsigned int num_syms; const unsigned long *crcs; /* GPL-only exported symbols. */ @@ -233,7 +233,7 @@ struct module #ifdef CONFIG_KALLSYMS /* We keep the symbol and string tables for kallsyms. */ Elf_Sym *symtab; - unsigned long num_syms; + unsigned long num_kallsyms; char *strtab; #endif diff --git a/kernel/module.c b/kernel/module.c index f37abf4c1e1b7..366bfd04621fd 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -156,7 +156,7 @@ static unsigned long __find_symbol(const char *name, /* Now try modules. */ list_for_each_entry(mod, &modules, list) { *owner = mod; - for (i = 0; i < mod->num_ksyms; i++) + for (i = 0; i < mod->num_syms; i++) if (strcmp(mod->syms[i].name, name) == 0) { *crc = symversion(mod->crcs, i); return mod->syms[i].value; @@ -1283,7 +1283,7 @@ static struct module *load_module(void *umod, mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr; #ifdef CONFIG_MODVERSIONS - if ((mod->num_ksyms&&!crcindex) || (mod->num_gpl_syms&&!gplcrcindex)) { + if ((mod->num_kallsyms && !crcindex) || (mod->num_gpl_syms && !gplcrcindex)) { printk(KERN_WARNING "%s: No versions for exported symbols." " Tainting kernel.\n", mod->name); tainted |= TAINT_FORCED_MODULE; @@ -1309,7 +1309,7 @@ static struct module *load_module(void *umod, #ifdef CONFIG_KALLSYMS mod->symtab = (void *)sechdrs[symindex].sh_addr; - mod->num_syms = sechdrs[symindex].sh_size / sizeof(Elf_Sym); + mod->num_kallsyms = sechdrs[symindex].sh_size / sizeof(Elf_Sym); mod->strtab = (void *)sechdrs[strindex].sh_addr; #endif err = module_finalize(hdr, sechdrs, mod); @@ -1452,7 +1452,7 @@ static const char *get_ksymbol(struct module *mod, /* Scan for closest preceeding symbol, and next symbol. (ELF starts real symbols at 1). */ - for (i = 1; i < mod->num_syms; i++) { + for (i = 1; i < mod->num_kallsyms; i++) { if (mod->symtab[i].st_shndx == SHN_UNDEF) continue; -- 2.53.0