summaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-05-27 11:09:37 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-05-28 11:32:08 +0930
commitb7df4d1b23bfca830f1076412d21524686c5a441 (patch)
treecd496160a6e3b493bb8d508e910a84eeb4ac6a09 /kernel/module.c
parent6c9692e2d6a2206d8fd75ea247daa47fb75e4a02 (diff)
downloadlinux-b7df4d1b23bfca830f1076412d21524686c5a441.tar.bz2
module: Use __module_address() for module_address_lookup()
Use the generic __module_address() addr to struct module lookup instead of open coding it once more. Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/kernel/module.c b/kernel/module.c
index ac3044ceca3f..293dfaf4ce52 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3671,19 +3671,15 @@ const char *module_address_lookup(unsigned long addr,
char **modname,
char *namebuf)
{
- struct module *mod;
const char *ret = NULL;
+ struct module *mod;
preempt_disable();
- list_for_each_entry_rcu(mod, &modules, list) {
- if (mod->state == MODULE_STATE_UNFORMED)
- continue;
- if (within_module(addr, mod)) {
- if (modname)
- *modname = mod->name;
- ret = get_ksymbol(mod, addr, size, offset);
- break;
- }
+ mod = __module_address(addr);
+ if (mod) {
+ if (modname)
+ *modname = mod->name;
+ ret = get_ksymbol(mod, addr, size, offset);
}
/* Make a copy in here where it's safe */
if (ret) {
@@ -3691,6 +3687,7 @@ const char *module_address_lookup(unsigned long addr,
ret = namebuf;
}
preempt_enable();
+
return ret;
}