From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Subject: [PATCH 4/6] perf header: Set nr_numa_nodes only when we parsed all the data
Date: Tue, 11 Oct 2016 14:14:10 +0200 [thread overview]
Message-ID: <1476188052-32316-5-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1476188052-32316-1-git-send-email-jolsa@kernel.org>
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.
Reported-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/n/tip-dt9c0zgkt4hybn2cr4xiawta@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 43ded20f1edf..d89c9c7ef4e5 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
if (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_unuse
free(str);
}
+ ph->env.nr_numa_nodes = nr;
ph->env.numa_nodes = nodes;
return 0;
--
2.7.4
next prev parent reply other threads:[~2016-10-11 12:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-11 12:14 [PATCH 0/6] perf tools: Header and c2c fixes Jiri Olsa
2016-10-11 12:14 ` [PATCH 1/6] perf report: Move captured info to generic header info Jiri Olsa
2016-10-11 12:14 ` [PATCH 2/6] perf header: Display missing features Jiri Olsa
2016-10-11 12:14 ` [PATCH 3/6] perf header: Display feature name on write failure Jiri Olsa
2016-10-11 12:14 ` Jiri Olsa [this message]
2016-10-11 12:14 ` [PATCH 5/6] perf c2c report: Add --no-source option Jiri Olsa
2016-10-11 12:14 ` [PATCH 6/6] perf c2c report: Add --show-all option Jiri Olsa
2016-10-11 12:59 ` [PATCH 0/6] tools lib: Add for_each_clear_bit macro Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476188052-32316-5-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox