summaryrefslogtreecommitdiff
path: root/tools/lib/symbol
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-02-15 15:26:27 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-02-16 20:25:56 +0300
commitc53b4bb02b45ceec7a590e47820afbb5cef0bb81 (patch)
treeffe56249f50fd1655934f65300c0f79e2ea2635b /tools/lib/symbol
parentf1f8ad52f8bf1239282737a2a5c3bd450300cc78 (diff)
downloadlinux-c53b4bb02b45ceec7a590e47820afbb5cef0bb81.tar.xz
tools lib symbol: Skip non-address kallsyms line
Adding check on failed attempt to parse the address and skip the line parsing early in that case. The address can be replaced with '(null)' string in case user don't have enough permissions, like: $ cat /proc/kallsyms (null) A irq_stack_union (null) A __per_cpu_start ... Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180215122635.24029-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/symbol')
-rw-r--r--tools/lib/symbol/kallsyms.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c
index 914cb8e3d40b..689b6a130dd7 100644
--- a/tools/lib/symbol/kallsyms.c
+++ b/tools/lib/symbol/kallsyms.c
@@ -38,6 +38,10 @@ int kallsyms__parse(const char *filename, void *arg,
len = hex2u64(line, &start);
+ /* Skip the line if we failed to parse the address. */
+ if (!len)
+ continue;
+
len++;
if (len + 2 >= line_len)
continue;