Re: [PATCH] perf tools: Don't set cmdline_group_boundary if no evsel is collected

From: Wangnan (F)
Date: Thu Aug 27 2015 - 07:28:10 EST

On 2015/8/26 16:32, Wang Nan wrote:
If parse_events__scanner() collects no entry, perf_evlist__last(evlist)
is invalid. Then setting of cmdline_group_boundary touches invalid.

It could happend in currect BPF implementation. See [1]. Although it
can be fixed, for safety reason it whould be better to introduce this


Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxxxxxxxx>
Cc: Masami Hiramatsu <>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
tools/perf/util/parse-events.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index cce3e43..02609da 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1171,9 +1171,11 @@ int parse_events(struct perf_evlist *evlist, const char *str,
perf_evlist__splice_list_tail(evlist, &data.list, entries);
evlist->nr_groups += data.nr_groups;
- last = perf_evlist__last(evlist);
- last->cmdline_group_boundary = true;
+ if (entries > 0) {

Now I think chinking this before list splice should be better. Plase ignore this patch.

Thank you.

+ last = perf_evlist__last(evlist);
+ last->cmdline_group_boundary = true;
+ }
return 0;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at