perf header: Set nr_numa_nodes only when we parsed all the data
tip-bot for Jiri Olsa
merge botCommit-ID: f957a5308dbbdf67aa4f8ac3233a61e802bd2373 Gitweb: http://git.kernel.org/tip/f957a5308dbbdf67aa4f8ac3233a61e802bd2373 Author: Jiri Olsa <[email protected]> AuthorDate: Mon, 10 Oct 2016 09:56:32 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 13 Oct 2016 11:12:29 -0300
perf header: Set nr_numa_nodes only when we parsed all the data
Sukadev reported segfault on releasing perf env's numa data. It's due to nr_numa_nodes being set no matter if the numa data gets parsed properly. The perf_env__exit crash the on releasing non existed data.
Setting nr_numa_nodes only when data are parsed out properly.
Signed-off-by Jiri Olsa <[email protected]>
Reported-by Sukadev Bhattiprolu <[email protected]>
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/header.c +1 -1
@@ -1895,7 +1895,6 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuseif (ph->needs_swap) nr =bswap_32 (nr); - ph->env.nr_numa_nodes = nr; nodes =zalloc (sizeof (*nodes) * nr);if (!nodes)return -ENOMEM ;
@@ -1932,6 +1931,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unusefree (str); } + ph->env.nr_numa_nodes = nr; ph->env.numa_nodes = nodes;return 0 ;