linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Andi Kleen <andi@firstfloor.org>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Wang Nan <wangnan0@huawei.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 05/19] tools lib traceevent: Add '~' operation within arg_num_eval()
Date: Thu, 10 Mar 2016 18:04:26 -0300	[thread overview]
Message-ID: <1457643880-4908-6-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1457643880-4908-1-git-send-email-acme@kernel.org>

From: Steven Rostedt <rostedt@goodmis.org>

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@goodmis.org>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20160226181328.22f47129@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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 865dea55454b..190cc886ab91 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;
-- 
2.5.0

  parent reply	other threads:[~2016-03-10 21:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 21:04 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 01/19] perf jitdump: DWARF is also needed Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 02/19] perf tools: Fix perf script python database export crash Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 03/19] perf tools: Pass perf_hpp_list all the way through setup_sort_list Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 04/19] perf tools: Omit unnecessary cast in perf_pmu__parse_scale Arnaldo Carvalho de Melo
2016-03-10 21:04 ` Arnaldo Carvalho de Melo [this message]
2016-03-10 21:04 ` [PATCH 06/19] perf jitdump: Build only on supported archs Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 07/19] perf tools: Fix hist_entry__filter() for hierarchy Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 08/19] perf tools: Add more sort entry check functions Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 09/19] perf tools: Fix command line filters in hierarchy mode Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 10/19] perf tools: Remove hist_entry->fmt field Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 11/19] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 12/19] perf tools: Remove nr_sort_keys field Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 13/19] perf tools: Recalc total periods using top-level entries in hierarchy Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 14/19] perf tools: Add sort__has_comm variable Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 15/19] perf hists browser: Allow thread filtering for comm sort key Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 16/19] perf hists browser: Check sort keys before hot key actions Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 17/19] perf stat: Document CSV format in manpage Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 18/19] perf stat: Implement --metric-only mode Arnaldo Carvalho de Melo
2016-03-10 21:04 ` [PATCH 19/19] perf stat: Add --metric-only support for -A Arnaldo Carvalho de Melo
2016-03-11  8:43 ` [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar

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=1457643880-4908-6-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=wangnan0@huawei.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;
as well as URLs for NNTP newsgroup(s).