aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 12067ff34d01..e814cd7da634 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2230,14 +2230,13 @@ static const char *get_ksymbol(struct module *mod,
2230 return mod->strtab + mod->symtab[best].st_name; 2230 return mod->strtab + mod->symtab[best].st_name;
2231} 2231}
2232 2232
2233/* For kallsyms to ask for address resolution. NULL means not found. 2233/* For kallsyms to ask for address resolution. NULL means not found. Careful
2234 We don't lock, as this is used for oops resolution and races are a 2234 * not to lock to avoid deadlock on oopses, simply disable preemption. */
2235 lesser concern. */ 2235char *module_address_lookup(unsigned long addr,
2236/* FIXME: Risky: returns a pointer into a module w/o lock */ 2236 unsigned long *size,
2237const char *module_address_lookup(unsigned long addr, 2237 unsigned long *offset,
2238 unsigned long *size, 2238 char **modname,
2239 unsigned long *offset, 2239 char *namebuf)
2240 char **modname)
2241{ 2240{
2242 struct module *mod; 2241 struct module *mod;
2243 const char *ret = NULL; 2242 const char *ret = NULL;
@@ -2252,8 +2251,13 @@ const char *module_address_lookup(unsigned long addr,
2252 break; 2251 break;
2253 } 2252 }
2254 } 2253 }
2254 /* Make a copy in here where it's safe */
2255 if (ret) {
2256 strncpy(namebuf, ret, KSYM_NAME_LEN - 1);
2257 ret = namebuf;
2258 }
2255 preempt_enable(); 2259 preempt_enable();
2256 return ret; 2260 return (char *)ret;
2257} 2261}
2258 2262
2259int lookup_module_symbol_name(unsigned long addr, char *symname) 2263int lookup_module_symbol_name(unsigned long addr, char *symname)