perf tools: Don't assume that the parser returns non empty evsel list
authorWang Nan <wangnan0@huawei.com>
Sun, 6 Sep 2015 07:13:17 +0000 (07:13 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 21 Sep 2015 21:01:17 +0000 (18:01 -0300)
commit854f736364c659046f066a98fed2fdb10a39577a
treeda2002faff38a45df4b5d21ba3df4803ba9dbbc2
parent0fb18553478dee5b3d8dc0af4f99a5288e81142f
perf tools: Don't assume that the parser returns non empty evsel list

Don't blindly retrieve and use a last element in the lists returned by
parse_events__scanner(), as it may have collected no entries, i.e.
return an empty list.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kaixu Xia <xiakaixu@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441523623-152703-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/parse-events.c