]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
module: Use __module_address() for module_address_lookup()
authorPeter Zijlstra <peterz@infradead.org>
Wed, 27 May 2015 01:39:37 +0000 (11:09 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 28 May 2015 02:02:08 +0000 (11:32 +0930)
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>
kernel/module.c

index ac3044ceca3ffb12f488d202e99bc8f5b930c8d6..293dfaf4ce52ee03ec291cf5fa0bbd44115789e6 100644 (file)
@@ -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;
 }