[PATCH] kmemleak: Scan the jump label module section

From: Catalin Marinas
Date: Wed May 15 2013 - 10:30:46 EST


Objects allocated in jump_label_add_module() are currently reported as
leaks, though the pointers are stored in the module jump label section.
This patch informs kmemleak that this section needs to be scanned.

Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Reported-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/module.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/kernel/module.c b/kernel/module.c
index b049939..ff83711 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2764,6 +2764,13 @@ static void find_module_sections(struct module *mod, struct load_info *info)
mod->jump_entries = section_objs(info, "__jump_table",
sizeof(*mod->jump_entries),
&mod->num_jump_entries);
+ /*
+ * This section contains pointers to objects allocated in
+ * jump_label_add_module() and not scanning it leads to false
+ * positives.
+ */
+ kmemleak_scan_area(mod->jump_entries, sizeof(*mod->jump_entries) *
+ mod->num_jump_entries, GFP_KERNEL);
#endif
#ifdef CONFIG_EVENT_TRACING
mod->trace_events = section_objs(info, "_ftrace_events",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/