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
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -106,9 +106,10 @@ static nokprobe_inline bool trace_kprobe_has_gone(struct trace_kprobe *tk) · 105 unmodified lines | |||
| 106 | static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, | 106 | static nokprobe_inline bool trace_kprobe_within_module(struct trace_kprobe *tk, |
| 107 | struct module *mod) | 107 | struct module *mod) |
| 108 | { | 108 | { |
| 109 | int len = strlen(mod->name); | 109 | int len = strlen(module_name(mod)); |
| 110 | const char *name = trace_kprobe_symbol(tk); | 110 | 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] == ':'; | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | static nokprobe_inline bool trace_kprobe_module_exist(struct trace_kprobe *tk) | 115 | 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, · 573 unmodified lines | |||
| 688 | if (ret) | 689 | if (ret) |
| 689 | pr_warn("Failed to re-register probe %s on %s: %d\n", | 690 | pr_warn("Failed to re-register probe %s on %s: %d\n", |
| 690 | trace_probe_name(&tk->tp), | 691 | trace_probe_name(&tk->tp), |
| 691 | mod->name, ret); | 692 | module_name(mod), ret); |
| 692 | } | 693 | } |
| 693 | } | 694 | } |
| 694 | mutex_unlock(&event_mutex); | 695 | mutex_unlock(&event_mutex); |