Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7df4d1b authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Rusty Russell
Browse files

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: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 6c9692e2
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -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)) {
	mod = __module_address(addr);
	if (mod) {
		if (modname)
			*modname = mod->name;
		ret = get_ksymbol(mod, addr, size, offset);
			break;
		}
	}
	/* 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;
}