From: Ye Bin Date: Thu, 29 May 2025 11:19:55 +0000 (+0800) Subject: ftrace: Don't allocate ftrace module map if ftrace is disabled X-Git-Tag: v6.16-rc1~58^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5834a597386c59fedc601a81091028074d6ae9a2;p=thirdparty%2Flinux.git 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 Signed-off-by: Steven Rostedt (Google) --- diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 84fd2f8263fa5..a7291685902e8 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;