Use the generic __module_address() addr to struct module lookup
instead of open coding it once more.

Cc: Rusty Russell <ru...@rustcorp.com.au>
Signed-off-by: Peter Zijlstra (Intel) <pet...@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;
 }
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to