Skip to content

Commit 5834a59

Browse files
Ye Binrostedt
authored andcommitted
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>
1 parent f914b52 commit 5834a59

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7631,6 +7631,9 @@ allocate_ftrace_mod_map(struct module *mod,
76317631
{
76327632
struct ftrace_mod_map *mod_map;
76337633

7634+
if (ftrace_disabled)
7635+
return NULL;
7636+
76347637
mod_map = kmalloc(sizeof(*mod_map), GFP_KERNEL);
76357638
if (!mod_map)
76367639
return NULL;

0 commit comments

Comments
 (0)