public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6.31 PATCH] tracing/filters: don't use pred on alloc failure
@ 2009-08-08 15:49 Tom Zanussi
  2009-08-08 16:03 ` [tip:tracing/core] tracing/filters: Don't " tip-bot for Tom Zanussi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Zanussi @ 2009-08-08 15:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Dan Carpenter, Steven Rostedt, Frederic Weisbecker, Li Zefan,
	LKML

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.

Signed-off-by: Tom Zanussi <tzanussi@gmail.com>

The original report:

create_logical_pred() could sometimes return NULL.

It's a static checker complaining rather than problems at runtime...

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 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);
-- 
1.5.6.3




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip:tracing/core] tracing/filters: Don't use pred on alloc failure
  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
  0 siblings, 0 replies; 3+ messages in thread
From: tip-bot for Tom Zanussi @ 2009-08-08 16:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tzanussi, lizf, fweisbec, error27,
	rostedt, tglx, mingo

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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip:tracing/core] tracing/filters: Don't use pred on alloc failure
  2009-08-08 15:49 [tip PATCH] tracing/filters: don't " Tom Zanussi
@ 2009-08-08 16:04 ` tip-bot for Tom Zanussi
  0 siblings, 0 replies; 3+ messages in thread
From: tip-bot for Tom Zanussi @ 2009-08-08 16:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tzanussi, lizf, fweisbec, error27,
	rostedt, tglx, mingo

Commit-ID:  fb82ad719831db58e9baa4c67015aae3fe27e7e3
Gitweb:     http://git.kernel.org/tip/fb82ad719831db58e9baa4c67015aae3fe27e7e3
Author:     Tom Zanussi <tzanussi@gmail.com>
AuthorDate: Sat, 8 Aug 2009 10:49:36 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 8 Aug 2009 17:58:07 +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.  This updates his patch for the same
problem in the tracing tree (which has changed this code quite
substantially).

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: <1249746576.6453.30.camel@tropicana>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
The original report:

create_logical_pred() could sometimes return NULL.

It's a static checker complaining rather than problems at runtime...


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

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 27c2dbe..490337a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1050,6 +1050,8 @@ static int replace_preds(struct event_subsystem *system,
 
 		pred = create_pred(elt->op, operand1, operand2);
 add_pred:
+		if (!pred)
+			return -ENOMEM;
 		if (call)
 			err = filter_add_pred(ps, call, pred, false);
 		else

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-08-08 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:tracing/core] tracing/filters: Don't " tip-bot for Tom Zanussi
  -- strict thread matches above, loose matches on Subject: below --
2009-08-08 15:49 [tip PATCH] tracing/filters: don't " Tom Zanussi
2009-08-08 16:04 ` [tip:tracing/core] tracing/filters: Don't " tip-bot for Tom Zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox