Messages in this thread Patch in this message | | | Date | Wed, 08 Apr 2015 18:48:22 +0200 | From | Peter Zijlstra <> | Subject | [PATCH v4 9/9] 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> --- kernel/module.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
--- a/kernel/module.c +++ b/kernel/module.c @@ -3515,19 +3515,15 @@ const char *module_address_lookup(unsign 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) { @@ -3535,6 +3531,7 @@ const char *module_address_lookup(unsign ret = namebuf; } preempt_enable(); + return ret; }
| |