diff options
author | Ye Bin <yebin10@huawei.com> | 2025-05-29 19:19:55 +0800 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2025-06-02 13:12:26 -0400 |
commit | 5834a597386c59fedc601a81091028074d6ae9a2 (patch) | |
tree | ceeadcc63361e6e5e9c14db20b2b0e3ff94d98fb | |
parent | f914b52c379c12288b7623bb814d0508dbe7481d (diff) |
ftrace: Don't allocate ftrace module map if ftrace is disabled
If ftrace is disabled, it is meaningless to allocate a module map.
Add a check in allocate_ftrace_mod_map() to not allocate if ftrace is
disabled.
Link: https://lore.kernel.org/20250529111955.2349189-3-yebin@huaweicloud.com
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/ftrace.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 84fd2f8263fa..a7291685902e 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -7631,6 +7631,9 @@ allocate_ftrace_mod_map(struct module *mod, { struct ftrace_mod_map *mod_map; + if (ftrace_disabled) + return NULL; + mod_map = kmalloc(sizeof(*mod_map), GFP_KERNEL); if (!mod_map) return NULL; |