public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Tom Zanussi <tzanussi@gmail.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,
	error27@gmail.com, rostedt@goodmis.org, tglx@linutronix.de,
	mingo@elte.hu
Subject: [tip:tracing/core] tracing/filters: Don't use pred on alloc failure
Date: Sat, 8 Aug 2009 16:03:36 GMT	[thread overview]
Message-ID: <tip-96b2de313b1e0e02aea80ee47df6a2b5cbdf8e13@git.kernel.org> (raw)
In-Reply-To: <1249746549.6453.29.camel@tropicana>

Commit-ID:  96b2de313b1e0e02aea80ee47df6a2b5cbdf8e13
Gitweb:     http://git.kernel.org/tip/96b2de313b1e0e02aea80ee47df6a2b5cbdf8e13
Author:     Tom Zanussi <tzanussi@gmail.com>
AuthorDate: Sat, 8 Aug 2009 10:49:09 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 8 Aug 2009 17:55:34 +0200

tracing/filters: Don't use pred on alloc failure

Dan Carpenter sent me a fix to prevent pred from being used if
it couldn't be allocated.  I noticed the same problem also
existed for the create_pred() case and added a fix for that.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <1249746549.6453.29.camel@tropicana>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 kernel/trace/trace_events_filter.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 936c621..1557148 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1029,6 +1029,8 @@ static int replace_preds(struct event_subsystem *system,
 
 		if (elt->op == OP_AND || elt->op == OP_OR) {
 			pred = create_logical_pred(elt->op);
+			if (!pred)
+				return -ENOMEM;
 			if (call) {
 				err = filter_add_pred(ps, call, pred);
 				filter_free_pred(pred);
@@ -1048,6 +1050,8 @@ static int replace_preds(struct event_subsystem *system,
 		}
 
 		pred = create_pred(elt->op, operand1, operand2);
+		if (!pred)
+			return -ENOMEM;
 		if (call) {
 			err = filter_add_pred(ps, call, pred);
 			filter_free_pred(pred);

  reply	other threads:[~2009-08-08 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08 15:49 [2.6.31 PATCH] tracing/filters: don't use pred on alloc failure Tom Zanussi
2009-08-08 16:03 ` tip-bot for Tom Zanussi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-08-08 15:49 [tip " Tom Zanussi
2009-08-08 16:04 ` [tip:tracing/core] tracing/filters: Don't " tip-bot for 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-96b2de313b1e0e02aea80ee47df6a2b5cbdf8e13@git.kernel.org \
    --to=tzanussi@gmail.com \
    --cc=error27@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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