From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>, David Ahern <dsahern@gmail.com>,
Andi Kleen <ak@linux.intel.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
kernel-team@lge.com
Subject: Re: [PATCH 1/2] tools lib symbol: Use strtoul instead of hex2u64 in kallsyms__parse
Date: Fri, 26 Jan 2018 15:36:35 +0900 [thread overview]
Message-ID: <20180126063635.GB22737@sejong> (raw)
In-Reply-To: <20180119161103.15035-2-jolsa@kernel.org>
On Fri, Jan 19, 2018 at 05:11:02PM +0100, Jiri Olsa wrote:
> Current kallsyms__parse uses hex2u64, which gives
> no indication of error. Using strtoul to checkup
> on failed attempt to parse the number and stop the
> rest of the kallsyms__parse processing early.
>
> Link: http://lkml.kernel.org/n/tip-djqwni3p6lgctf6o7xhhwpmw@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/lib/symbol/kallsyms.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c
> index 914cb8e3d40b..dd5bb1dfd2b6 100644
> --- a/tools/lib/symbol/kallsyms.c
> +++ b/tools/lib/symbol/kallsyms.c
> @@ -29,6 +29,7 @@ int kallsyms__parse(const char *filename, void *arg,
> int line_len, len;
> char symbol_type;
> char *symbol_name;
> + char *endptr;
>
> line_len = getline(&line, &n, file);
> if (line_len < 0 || !line)
> @@ -36,9 +37,12 @@ int kallsyms__parse(const char *filename, void *arg,
>
> line[--line_len] = '\0'; /* \n */
>
> - len = hex2u64(line, &start);
> + start = strtoul(line, &endptr, 16);
> + if (line == endptr)
> + continue;
> +
> + len = endptr - line + 1;
>
> - len++;
> if (len + 2 >= line_len)
> continue;
>
> --
> 2.13.6
>
next prev parent reply other threads:[~2018-01-26 6:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 16:11 [PATCH 0/2] perf report: Fix kallsyms parsing Jiri Olsa
2018-01-19 16:11 ` [PATCH 1/2] tools lib symbol: Use strtoul instead of hex2u64 in kallsyms__parse Jiri Olsa
2018-01-26 6:36 ` Namhyung Kim [this message]
2018-01-26 17:22 ` Andy Shevchenko
2018-01-26 17:27 ` Andy Shevchenko
2018-01-29 7:18 ` Jiri Olsa
2018-01-29 13:05 ` Andy Shevchenko
2018-01-19 16:11 ` [PATCH 2/2] perf tools: Skip read of kernel maps once it failed Jiri Olsa
2018-01-26 6:48 ` Namhyung Kim
2018-01-30 11:21 ` 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=20180126063635.GB22737@sejong \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-team@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.