kmemleak: Scan the _ftrace_events section in modules
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 28 Oct 2009 13:33:10 +0000 (13:33 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 28 Oct 2009 17:07:54 +0000 (17:07 +0000)
This section contains pointers to allocated objects and not scanning it
leads to false positives.

Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
kernel/module.c

index 1eb952097077eb9bb253f912ee8b03f7df8b244b..dd29ba43c34f5a38de223f728cef9d23a7738735 100644 (file)
@@ -2380,6 +2380,12 @@ static noinline struct module *load_module(void __user *umod,
                                         "_ftrace_events",
                                         sizeof(*mod->trace_events),
                                         &mod->num_trace_events);
+       /*
+        * This section contains pointers to allocated objects in the trace
+        * code and not scanning it leads to false positives.
+        */
+       kmemleak_scan_area(mod->trace_events, sizeof(*mod->trace_events) *
+                          mod->num_trace_events, GFP_KERNEL);
 #endif
 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
        /* sechdrs[0].sh_size is always zero */