* [PATCH 1/4] tools lib traceevent: Fix error path on process_array()
2012-09-19 6:58 [PATCH 0/4] tools lib traceevent: Small fixes on error handling path Namhyung Kim
@ 2012-09-19 6:58 ` Namhyung Kim
2012-09-27 5:36 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-09-19 6:58 ` [PATCH 2/4] tools lib traceevent: Make sure that arg->op.right is set properly Namhyung Kim
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-09-19 6:58 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, LKML,
Namhyung Kim
From: Namhyung Kim <namhyung.kim@lge.com>
free_token() under out_free should be called with 'token' and no need
to set *tok to NULL since it's set already.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index ee4fa1912542..11f76a59711f 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1636,8 +1636,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok)
return type;
out_free:
- free_token(*tok);
- *tok = NULL;
+ free_token(token);
free_arg(arg);
return EVENT_ERROR;
}
--
1.7.11.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [tip:perf/core] tools lib traceevent: Fix error path on process_array()
2012-09-19 6:58 ` [PATCH 1/4] tools lib traceevent: Fix error path on process_array() Namhyung Kim
@ 2012-09-27 5:36 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-09-27 5:36 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung.kim,
namhyung, fweisbec, rostedt, tglx
Commit-ID: 1bce6e0fec28434fd66de585773a14bf4d2c3715
Gitweb: http://git.kernel.org/tip/1bce6e0fec28434fd66de585773a14bf4d2c3715
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 19 Sep 2012 15:58:41 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Sep 2012 12:00:15 -0300
tools lib traceevent: Fix error path on process_array()
free_token() under out_free should be called with 'token' and no need
to set *tok to NULL since it's set already.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1348037924-17568-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 77ebeb8..6270ee2 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1595,8 +1595,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok)
return type;
out_free:
- free_token(*tok);
- *tok = NULL;
+ free_token(token);
free_arg(arg);
return EVENT_ERROR;
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] tools lib traceevent: Make sure that arg->op.right is set properly
2012-09-19 6:58 [PATCH 0/4] tools lib traceevent: Small fixes on error handling path Namhyung Kim
2012-09-19 6:58 ` [PATCH 1/4] tools lib traceevent: Fix error path on process_array() Namhyung Kim
@ 2012-09-19 6:58 ` Namhyung Kim
2012-09-27 5:37 ` [tip:perf/core] tools lib traceevent: Make sure that arg->op. right " tip-bot for Namhyung Kim
2012-09-19 6:58 ` [PATCH 3/4] tools lib traceevent: Free field if an error occurs on process_fields Namhyung Kim
2012-09-19 6:58 ` [PATCH 4/4] tools lib traceevent: Free field if an error occurs on process_flags/symbols Namhyung Kim
3 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-09-19 6:58 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, LKML,
Namhyung Kim
From: Namhyung Kim <namhyung.kim@lge.com>
When process_op failed, @arg will be freed on a caller with type of
PRINT_OP. Thus free_arg() will try to free ->op.right field which can
have stale value if something bad happens in the middle.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 11f76a59711f..bc4e70e3ba29 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1772,6 +1772,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->op.left = left;
arg->op.prio = 0;
+ /* it will set arg->op.right */
type = process_cond(event, arg, tok);
} else if (strcmp(token, ">>") == 0 ||
@@ -1802,6 +1803,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->type = PRINT_OP;
arg->op.op = token;
arg->op.left = left;
+ arg->op.right = NULL;
if (set_op_prio(arg) == -1) {
event->flags |= EVENT_FL_FAILED;
@@ -1859,6 +1861,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->op.prio = 0;
+ /* it will set arg->op.right */
type = process_array(event, arg, tok);
} else {
--
1.7.11.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [tip:perf/core] tools lib traceevent: Make sure that arg->op. right is set properly
2012-09-19 6:58 ` [PATCH 2/4] tools lib traceevent: Make sure that arg->op.right is set properly Namhyung Kim
@ 2012-09-27 5:37 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-09-27 5:37 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung.kim,
namhyung, fweisbec, rostedt, tglx
Commit-ID: 41e51a289b3ca83e08395213f4488c9c7c6b2e29
Gitweb: http://git.kernel.org/tip/41e51a289b3ca83e08395213f4488c9c7c6b2e29
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 19 Sep 2012 15:58:42 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Sep 2012 12:01:21 -0300
tools lib traceevent: Make sure that arg->op.right is set properly
When process_op failed, @arg will be freed on a caller with type of
PRINT_OP. Thus free_arg() will try to free ->op.right field which can
have stale value if something bad happens in the middle.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1348037924-17568-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 6270ee2..27088c5 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1719,6 +1719,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->op.left = left;
arg->op.prio = 0;
+ /* it will set arg->op.right */
type = process_cond(event, arg, tok);
} else if (strcmp(token, ">>") == 0 ||
@@ -1745,6 +1746,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->type = PRINT_OP;
arg->op.op = token;
arg->op.left = left;
+ arg->op.right = NULL;
if (set_op_prio(arg) == -1) {
event->flags |= EVENT_FL_FAILED;
@@ -1792,6 +1794,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
arg->op.prio = 0;
+ /* it will set arg->op.right */
type = process_array(event, arg, tok);
} else {
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] tools lib traceevent: Free field if an error occurs on process_fields
2012-09-19 6:58 [PATCH 0/4] tools lib traceevent: Small fixes on error handling path Namhyung Kim
2012-09-19 6:58 ` [PATCH 1/4] tools lib traceevent: Fix error path on process_array() Namhyung Kim
2012-09-19 6:58 ` [PATCH 2/4] tools lib traceevent: Make sure that arg->op.right is set properly Namhyung Kim
@ 2012-09-19 6:58 ` Namhyung Kim
2012-09-27 5:38 ` [tip:perf/core] " tip-bot for Namhyung Kim
2012-09-19 6:58 ` [PATCH 4/4] tools lib traceevent: Free field if an error occurs on process_flags/symbols Namhyung Kim
3 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-09-19 6:58 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, LKML,
Namhyung Kim
From: Namhyung Kim <namhyung.kim@lge.com>
The field should be freed on error paths.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index bc4e70e3ba29..e0f755111bd0 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2262,10 +2262,10 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
value = arg_eval(arg);
if (value == NULL)
- goto out_free;
+ goto out_free_field;
field->value = strdup(value);
if (field->value == NULL)
- goto out_free;
+ goto out_free_field;
free_arg(arg);
arg = alloc_arg();
@@ -2275,14 +2275,14 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
free_token(token);
type = process_arg(event, arg, &token);
if (test_type_token(type, token, EVENT_OP, "}"))
- goto out_free;
+ goto out_free_field;
value = arg_eval(arg);
if (value == NULL)
- goto out_free;
+ goto out_free_field;
field->str = strdup(value);
if (field->str == NULL)
- goto out_free;
+ goto out_free_field;
free_arg(arg);
arg = NULL;
@@ -2296,6 +2296,8 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
*tok = token;
return type;
+out_free_field:
+ free_flag_sym(field);
out_free:
free_arg(arg);
free_token(token);
--
1.7.11.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip:perf/core] tools lib traceevent: Free field if an error occurs on process_fields
2012-09-19 6:58 ` [PATCH 3/4] tools lib traceevent: Free field if an error occurs on process_fields Namhyung Kim
@ 2012-09-27 5:38 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-09-27 5:38 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung.kim,
namhyung, fweisbec, rostedt, tglx
Commit-ID: f8c49d2645e5028e48ba15ec72728be121eddf95
Gitweb: http://git.kernel.org/tip/f8c49d2645e5028e48ba15ec72728be121eddf95
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 19 Sep 2012 15:58:43 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Sep 2012 12:02:38 -0300
tools lib traceevent: Free field if an error occurs on process_fields
The field should be freed on error paths.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1348037924-17568-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 27088c5..a776ed5 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2186,10 +2186,10 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
value = arg_eval(arg);
if (value == NULL)
- goto out_free;
+ goto out_free_field;
field->value = strdup(value);
if (field->value == NULL)
- goto out_free;
+ goto out_free_field;
free_arg(arg);
arg = alloc_arg();
@@ -2197,14 +2197,14 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
free_token(token);
type = process_arg(event, arg, &token);
if (test_type_token(type, token, EVENT_OP, "}"))
- goto out_free;
+ goto out_free_field;
value = arg_eval(arg);
if (value == NULL)
- goto out_free;
+ goto out_free_field;
field->str = strdup(value);
if (field->str == NULL)
- goto out_free;
+ goto out_free_field;
free_arg(arg);
arg = NULL;
@@ -2218,6 +2218,8 @@ process_fields(struct event_format *event, struct print_flag_sym **list, char **
*tok = token;
return type;
+out_free_field:
+ free_flag_sym(field);
out_free:
free_arg(arg);
free_token(token);
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] tools lib traceevent: Free field if an error occurs on process_flags/symbols
2012-09-19 6:58 [PATCH 0/4] tools lib traceevent: Small fixes on error handling path Namhyung Kim
` (2 preceding siblings ...)
2012-09-19 6:58 ` [PATCH 3/4] tools lib traceevent: Free field if an error occurs on process_fields Namhyung Kim
@ 2012-09-19 6:58 ` Namhyung Kim
2012-09-27 5:39 ` [tip:perf/core] " tip-bot for Namhyung Kim
3 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-09-19 6:58 UTC (permalink / raw)
To: Steven Rostedt, Arnaldo Carvalho de Melo
Cc: Frederic Weisbecker, Peter Zijlstra, Ingo Molnar, LKML,
Namhyung Kim
From: Namhyung Kim <namhyung.kim@lge.com>
The field should be freed on error paths.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/lib/traceevent/event-parse.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index e0f755111bd0..4d6c1e9f45f0 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2329,7 +2329,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
type = process_op(event, field, &token);
if (test_type_token(type, token, EVENT_DELIM, ","))
- goto out_free;
+ goto out_free_field;
free_token(token);
arg->flags.field = field;
@@ -2351,7 +2351,9 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
type = read_token_item(tok);
return type;
- out_free:
+out_free_field:
+ free_arg(field);
+out_free:
free_token(token);
*tok = NULL;
return EVENT_ERROR;
@@ -2375,7 +2377,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
type = process_arg(event, field, &token);
if (test_type_token(type, token, EVENT_DELIM, ","))
- goto out_free;
+ goto out_free_field;
arg->symbol.field = field;
@@ -2387,7 +2389,9 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
type = read_token_item(tok);
return type;
- out_free:
+out_free_field:
+ free_arg(field);
+out_free:
free_token(token);
*tok = NULL;
return EVENT_ERROR;
--
1.7.11.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [tip:perf/core] tools lib traceevent: Free field if an error occurs on process_flags/symbols
2012-09-19 6:58 ` [PATCH 4/4] tools lib traceevent: Free field if an error occurs on process_flags/symbols Namhyung Kim
@ 2012-09-27 5:39 ` tip-bot for Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-09-27 5:39 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, a.p.zijlstra, namhyung.kim,
namhyung, fweisbec, rostedt, tglx
Commit-ID: 70d9304475730a63dd8da884abc7c76ee4772cd2
Gitweb: http://git.kernel.org/tip/70d9304475730a63dd8da884abc7c76ee4772cd2
Author: Namhyung Kim <namhyung.kim@lge.com>
AuthorDate: Wed, 19 Sep 2012 15:58:44 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Sep 2012 12:03:18 -0300
tools lib traceevent: Free field if an error occurs on process_flags/symbols
The field should be freed on error paths.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1348037924-17568-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index a776ed5..acf4038 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2247,7 +2247,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
type = process_op(event, field, &token);
if (test_type_token(type, token, EVENT_DELIM, ","))
- goto out_free;
+ goto out_free_field;
free_token(token);
arg->flags.field = field;
@@ -2269,7 +2269,9 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
type = read_token_item(tok);
return type;
- out_free:
+out_free_field:
+ free_arg(field);
+out_free:
free_token(token);
*tok = NULL;
return EVENT_ERROR;
@@ -2289,7 +2291,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
type = process_arg(event, field, &token);
if (test_type_token(type, token, EVENT_DELIM, ","))
- goto out_free;
+ goto out_free_field;
arg->symbol.field = field;
@@ -2301,7 +2303,9 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
type = read_token_item(tok);
return type;
- out_free:
+out_free_field:
+ free_arg(field);
+out_free:
free_token(token);
*tok = NULL;
return EVENT_ERROR;
^ permalink raw reply related [flat|nested] 9+ messages in thread