diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-10-10 03:56:32 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-10-13 10:12:29 -0400 |
commit | f957a5308dbbdf67aa4f8ac3233a61e802bd2373 (patch) | |
tree | aa663a34f7247226985829f67ac71152f29a5be8 /tools/perf | |
parent | c611152373e84a7677cd7d496e849de4debdab66 (diff) |
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 <jolsa@kernel.org>
Reported-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-dt9c0zgkt4hybn2cr4xiawta@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/header.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 85dd0db0a127..2f3eded54b0c 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1895,7 +1895,6 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse | |||
1895 | if (ph->needs_swap) | 1895 | if (ph->needs_swap) |
1896 | nr = bswap_32(nr); | 1896 | nr = bswap_32(nr); |
1897 | 1897 | ||
1898 | ph->env.nr_numa_nodes = nr; | ||
1899 | nodes = zalloc(sizeof(*nodes) * nr); | 1898 | nodes = zalloc(sizeof(*nodes) * nr); |
1900 | if (!nodes) | 1899 | if (!nodes) |
1901 | return -ENOMEM; | 1900 | return -ENOMEM; |
@@ -1932,6 +1931,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse | |||
1932 | 1931 | ||
1933 | free(str); | 1932 | free(str); |
1934 | } | 1933 | } |
1934 | ph->env.nr_numa_nodes = nr; | ||
1935 | ph->env.numa_nodes = nodes; | 1935 | ph->env.numa_nodes = nodes; |
1936 | return 0; | 1936 | return 0; |
1937 | 1937 | ||