Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217294

[PATCH] perf tools: Don't set leader if parser doesn't collect an evsel

From Wang Nan <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH] perf tools: Don't set leader if parser doesn't collect an evsel
Date 2015-09-02 05:00 +0200
Message-ID <q46rf-x8-1@gated-at.bofh.it> (permalink)
References <q2FWa-7Rj-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Similar to patch 'perf tools: Don't set cmdline_group_boundary if no
evsel is collected', in case when parser collects no evsel (at this
point it shouldn't happen), parse_events__set_leader() is not safe.

This patch checks list_empty becore calling __perf_evlist__set_leader()
for safty reason.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---

I'd like to queue this patch into my next pull request. Since it is not
a real bug, it may be dropped.

---
 tools/perf/util/parse-events.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f2c0317..836d226 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -793,6 +793,9 @@ void parse_events__set_leader(char *name, struct list_head *list)
 {
 	struct perf_evsel *leader;
 
+	if (list_empty(list))
+		return;
+
 	__perf_evlist__set_leader(list);
 	leader = list_entry(list->next, struct perf_evsel, node);
 	leader->group_name = name ? strdup(name) : NULL;
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no evsel is collected Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
  Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-08-31 21:30 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Jiri Olsa <jolsa@redhat.com> - 2015-09-01 12:40 +0200
      Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 14:50 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 13:00 +0200
  [PATCH] perf tools: Don't set leader if parser doesn't collect an evsel Wang Nan <wangnan0@huawei.com> - 2015-09-02 05:00 +0200
    Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 05:10 +0200
    RE: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 08:00 +0200
      Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 08:10 +0200
      Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect  evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 09:00 +0200
        RE: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 12:40 +0200
        Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:00 +0200
          Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 14:10 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:50 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:00 +0200
              Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 16:10 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:50 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-03 00:30 +0200

csiph-web