Skip to content

Commit f3d3642

Browse files
Jarkko Sakkinenrostedt
authored andcommitted
kprobes: Use module_name() macro
It is advised to use module_name() macro instead of dereferencing mod->name directly. This makes sense for consistencys sake and also it prevents a hard dependency to CONFIG_MODULES. Link: https://lkml.kernel.org/r/20200818050857.117998-1-jarkko.sakkinen@linux.intel.com Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: linux-mm@kvack.org Cc: Andi Kleen <ak@linux.intel.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Jessica Yu <jeyu@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com>, Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King <linux@armlinux.org.uk> Cc: Will Deacon <will@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent b427e76 commit f3d3642

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎kernel/trace/trace_kprobe.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk)
106106
static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk,
107107
struct module *mod)
108108
{
109-
int len = strlen(mod->name);
109+
int len = strlen(module_name(mod));
110110
const char *name = trace_kprobe_symbol(tk);
111-
return strncmp(mod->name, name, len) == 0 && name[len] == ':';
111+
112+
return strncmp(module_name(mod), name, len) == 0 && name[len] == ':';
112113
}
113114

114115
static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk)
@@ -688,7 +689,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
688689
if (ret)
689690
pr_warn("Failed to re-register probe %s on %s: %d\n",
690691
trace_probe_name(&tk->tp),
691-
mod->name, ret);
692+
module_name(mod), ret);
692693
}
693694
}
694695
mutex_unlock(&event_mutex);

0 commit comments

Comments
 (0)