[tip:perf/core] tools lib traceevent: Add '~' operation within arg_num_eval()
From: tip-bot for Steven Rostedt
Date: Fri Mar 11 2016 - 03:48:27 EST
Commit-ID: 9eb42dee2b11635174c74a7996934b6ca18f2179
Gitweb: http://git.kernel.org/tip/9eb42dee2b11635174c74a7996934b6ca18f2179
Author: Steven Rostedt <rostedt@xxxxxxxxxxx>
AuthorDate: Fri, 26 Feb 2016 18:13:28 -0500
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Thu, 10 Mar 2016 16:27:41 -0300
tools lib traceevent: Add '~' operation within arg_num_eval()
When evaluating values for print flags, if the value included a '~'
operator, the parsing would fail. This broke kmalloc's parsing of:
__print_flags(REC->gfp_flags, "|", {(unsigned
long)((((((( gfp_t)(0x400000u|0x2000000u)) | (( gfp_t)0x40u) |
(( gfp_t)0x80u) | (( gfp_t)0x20000u)) | (( gfp_t)0x02u)) |
(( gfp_t)0x08u)) | (( gfp_t)0x4000u) | (( gfp_t)0x10000u) |
(( gfp_t)0x1000u) | (( gfp_t)0x200u)) & ~(( gfp_t)0x2000000u))
^
|
here
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Reported-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Tested-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Andi Kleen <andi@xxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/20160226181328.22f47129@xxxxxxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/lib/traceevent/event-parse.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 865dea5..190cc88 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2398,6 +2398,12 @@ static int arg_num_eval(struct print_arg *arg, long long *val)
break;
*val = left + right;
break;
+ case '~':
+ ret = arg_num_eval(arg->op.right, &right);
+ if (!ret)
+ break;
+ *val = ~right;
+ break;
default:
do_warning("unknown op '%s'", arg->op.op);
ret = 0;