From: Paul Clarke <pc@us.ibm.com>
To: Milian Wolff <milian.wolff@kdab.com>, Linux-kernel@vger.kernel.org
Cc: linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
David Ahern <dsahern@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Yao Jin <yao.jin@linux.intel.com>
Subject: Re: [PATCH] perf report: don't crash on invalid maps in `-g srcline` mode
Date: Thu, 11 May 2017 08:13:24 -0500 [thread overview]
Message-ID: <0d08c9db-1715-c8b8-950d-9034760499b4@us.ibm.com> (raw)
In-Reply-To: <20170509205046.21473-1-milian.wolff@kdab.com>
On 05/09/2017 03:50 PM, Milian Wolff wrote:
> diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
> index 9ab68682c6d0..295f0846fd84 100644
> --- a/tools/perf/util/callchain.c
> +++ b/tools/perf/util/callchain.c
> @@ -642,13 +642,22 @@ static enum match_result match_chain_strings(const char *left,
> static enum match_result match_chain_srcline(struct callchain_cursor_node *node,
> struct callchain_list *cnode)
> {
> - char *left = get_srcline(cnode->ms.map->dso,
> - map__rip_2objdump(cnode->ms.map, cnode->ip),
> - cnode->ms.sym, true, false);
> - char *right = get_srcline(node->map->dso,
> - map__rip_2objdump(node->map, node->ip),
> - node->sym, true, false);
> - enum match_result ret = match_chain_strings(left, right);
> + char *left = NULL;
> + char *right = NULL;
nit: the above two initializations are unnecessary.
> + enum match_result ret = MATCH_ERROR;
> +
> + if (!node->map || !cnode->ms.map)
> + return ret;
> +
> + left = get_srcline(cnode->ms.map->dso,
> + map__rip_2objdump(cnode->ms.map, cnode->ip),
> + cnode->ms.sym, true, false);
> +
> + right = get_srcline(node->map->dso,
> + map__rip_2objdump(node->map, node->ip),
> + node->sym, true, false);
> +
> + ret = match_chain_strings(left, right);
>
> free_srcline(left);
> free_srcline(right);
PC
prev parent reply other threads:[~2017-05-11 13:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 20:50 [PATCH] perf report: don't crash on invalid maps in `-g srcline` mode Milian Wolff
2017-05-10 6:04 ` Namhyung Kim
2017-05-12 10:23 ` Milian Wolff
2017-05-12 12:19 ` Namhyung Kim
2017-05-11 13:13 ` Paul Clarke [this message]
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=0d08c9db-1715-c8b8-950d-9034760499b4@us.ibm.com \
--to=pc@us.ibm.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=namhyung@kernel.org \
--cc=yao.jin@linux.intel.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;
as well as URLs for NNTP newsgroup(s).