From: Ye Bin <[email protected]>

If the ftrace is disabled, it is meaningless to allocate module map.
So add check in allocate_ftrace_mod_map().

Signed-off-by: Ye Bin <[email protected]>
---
 kernel/trace/ftrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index ff5d9d73a4a7..1cac568a031c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -7626,6 +7626,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;
-- 
2.34.1


Reply via email to