Re: [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes

Steven Rostedt
2024-03-26T17:04:10Z

On Tue, 26 Mar 2024 15:53:38 +0100
Arnd Bergmann <arnd@kernel.org> wrote:

> -const char *
> +int
> ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
> unsigned long *off, char **modname, char *sym)
> {
> struct ftrace_mod_map *mod_map;
> - const char *ret = NULL;
> + int ret;

This needs to be ret = 0;

>
> /* mod_map is freed via call_rcu() */
> preempt_disable();

As here we have:

list_for_each_entry_rcu(mod_map, &ftrace_mod_maps, list) {
ret = ftrace_func_address_lookup(mod_map, addr, size, off, sym);
if (ret) {
if (modname)
*modname = mod_map->mod->name;
break;
}
}
preempt_enable();

return ret;
}

Where it is possible for the loop never to be executed.

-- Steve