From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
tzanussi@gmail.com, lizf@cn.fujitsu.com, fweisbec@gmail.com,
rostedt@goodmis.org, tglx@linutronix.de, mhiramat@redhat.com
Subject: [tip:tracing/core] tracing/filters: Defer pred allocation, fix memory leak
Date: Sun, 6 Sep 2009 04:36:33 GMT [thread overview]
Message-ID: <tip-c58b43218c1a04a0bcf338ea47406c759ac28e11@git.kernel.org> (raw)
In-Reply-To: <4A9CB1BA.3060402@cn.fujitsu.com>
Commit-ID: c58b43218c1a04a0bcf338ea47406c759ac28e11
Gitweb: http://git.kernel.org/tip/c58b43218c1a04a0bcf338ea47406c759ac28e11
Author: Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Tue, 1 Sep 2009 13:31:38 +0800
Committer: Frederic Weisbecker <fweisbec@gmail.com>
CommitDate: Fri, 4 Sep 2009 23:22:33 +0200
tracing/filters: Defer pred allocation, fix memory leak
The predicates of an event and their filter structure are allocated
when we create an event filter for the first time.
These objects must be created once but each time we come with a new
filter, we overwrite such pre-existing allocation, if any.
Thus, this patch checks if the filter has already been allocated
before going ahead.
Spotted-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <4A9CB1BA.3060402@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace_events_filter.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index c6b2edf..93660fb 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -409,6 +409,9 @@ static int init_preds(struct ftrace_event_call *call)
struct filter_pred *pred;
int i;
+ if (call->filter)
+ return 0;
+
filter = call->filter = kzalloc(sizeof(*filter), GFP_KERNEL);
if (!call->filter)
return -ENOMEM;
@@ -447,11 +450,9 @@ static int init_subsystem_preds(struct event_subsystem *system)
if (strcmp(call->system, system->name) != 0)
continue;
- if (!call->filter) {
- err = init_preds(call);
- if (err)
- return err;
- }
+ err = init_preds(call);
+ if (err)
+ return err;
}
return 0;
next prev parent reply other threads:[~2009-09-06 4:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-31 8:49 [PATCH] tracing/filters: Defer pred allocation Li Zefan
2009-08-31 8:59 ` Ingo Molnar
2009-08-31 9:06 ` Li Zefan
2009-09-01 12:58 ` Masami Hiramatsu
2009-08-31 9:00 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-08-31 17:41 ` [PATCH] " Frederic Weisbecker
2009-09-01 0:50 ` Li Zefan
2009-09-01 5:31 ` [PATCH] tracing/filters: Defer pred allocation, fix memory leak Li Zefan
2009-09-01 9:32 ` Frederic Weisbecker
2009-09-06 4:36 ` tip-bot for Li Zefan [this message]
2009-09-01 3:28 ` [PATCH] tracing/filters: Defer pred allocation Tom Zanussi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-c58b43218c1a04a0bcf338ea47406c759ac28e11@git.kernel.org \
--to=lizf@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox