aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 43a529a1fa48..5ee65994a3bc 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1472,7 +1472,7 @@ static void setup_modinfo(struct module *mod, Elf_Shdr *sechdrs,
1472} 1472}
1473 1473
1474#ifdef CONFIG_KALLSYMS 1474#ifdef CONFIG_KALLSYMS
1475int is_exported(const char *name, const struct module *mod) 1475static int is_exported(const char *name, const struct module *mod)
1476{ 1476{
1477 if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab)) 1477 if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab))
1478 return 1; 1478 return 1;
@@ -2124,8 +2124,8 @@ const char *module_address_lookup(unsigned long addr,
2124 return NULL; 2124 return NULL;
2125} 2125}
2126 2126
2127struct module *module_get_kallsym(unsigned int symnum, unsigned long *value, 2127int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2128 char *type, char *name) 2128 char *name, char *module_name, int *exported)
2129{ 2129{
2130 struct module *mod; 2130 struct module *mod;
2131 2131
@@ -2136,13 +2136,15 @@ struct module *module_get_kallsym(unsigned int symnum, unsigned long *value,
2136 *type = mod->symtab[symnum].st_info; 2136 *type = mod->symtab[symnum].st_info;
2137 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, 2137 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name,
2138 KSYM_NAME_LEN + 1); 2138 KSYM_NAME_LEN + 1);
2139 strlcpy(module_name, mod->name, MODULE_NAME_LEN + 1);
2140 *exported = is_exported(name, mod);
2139 mutex_unlock(&module_mutex); 2141 mutex_unlock(&module_mutex);
2140 return mod; 2142 return 0;
2141 } 2143 }
2142 symnum -= mod->num_symtab; 2144 symnum -= mod->num_symtab;
2143 } 2145 }
2144 mutex_unlock(&module_mutex); 2146 mutex_unlock(&module_mutex);
2145 return NULL; 2147 return -ERANGE;
2146} 2148}
2147 2149
2148static unsigned long mod_find_symname(struct module *mod, const char *name) 2150static unsigned long mod_find_symname(struct module *mod, const char *name)