summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-11-07 21:04:01 +0000
committerStephen Rothwell <sfr@canb.auug.org.au>2009-11-25 13:16:26 +1100
commit35bc677d0aa2cb041ad0dab32eab1d07e49f671c (patch)
tree8401dceaaf5ea7dc5f4217f54c991ef8eae2d4b5 /kernel
parent146461dd1de26c729bcdba67f89475bf9d8fe755 (diff)
module: fix is_exported() to return true for all types of exports
/proc/kallsyms annotates module symbols as global (e.g. 'D' for a data symbol) or local (e.g. 'd'), depending on whether is_exported() returns true or false. Historically, is_exported() only returns true if the symbol was exported using EXPORT_SYMBOL(). EXPORT_SYMBOL_UNUSED(), for example, is not taken into account. This looks like an oversight, so let's fix it. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 567afa563ba5..29432fd20340 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1855,33 +1855,19 @@ static void free_modinfo(struct module *mod)
#ifdef CONFIG_KALLSYMS
-/* lookup symbol in given range of kernel_symbols */
-static const struct kernel_symbol *lookup_symbol(const char *name,
- const struct kernel_symbol *syms,
- unsigned int count)
-{
- unsigned int i;
-
- for (i = 0; i < count; i++)
- if (strcmp(syms[i].name, name) == 0)
- return &syms[i];
- return NULL;
-}
-
static int is_exported(const char *name, unsigned long value,
- const struct module *mod)
+ struct module *mod)
{
- const struct ksymtab *symtab;
- const struct kernel_symbol *ks;
+ const struct kernel_symbol *sym;
+ enum export_type type;
+ const unsigned long *crc;
- if (!mod)
- symtab = &ksymtab[EXPORT_TYPE_PLAIN];
+ if (mod)
+ sym = find_symbol_in_module(mod, name, &type, &crc);
else
- symtab = &mod->syms[EXPORT_TYPE_PLAIN];
-
- ks = lookup_symbol(name, symtab->syms, symtab->num_syms);
+ sym = find_symbol_in_kernel(name, &type, &crc);
- return ks != NULL && ks->value == value;
+ return (sym && sym->value == value);
}
/* As per nm */