summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/build-id.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-11-02 00:31:02 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-11-03 13:14:45 +0100
commit6311951d4f8f28c43b554ff0719027884bedd7e3 (patch)
tree75f2db97d40d52fdd64b4fad34ff48ddd1a106b4 /tools/perf/util/build-id.c
parentperf hists browser: Increase size of 'buf' in perf_evsel__hists_browse() (diff)
downloadlinux-6311951d4f8f28c43b554ff0719027884bedd7e3.tar.xz
linux-6311951d4f8f28c43b554ff0719027884bedd7e3.zip
perf tools: Initialize output buffer in build_id__sprintf
We display garbage for undefined build_id objects, because we don't initialize the output buffer. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20201101233103.3537427-1-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/build-id.c')
-rw-r--r--tools/perf/util/build-id.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 8763772f1095..6b410c3d52dc 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -102,6 +102,8 @@ int build_id__sprintf(const struct build_id *build_id, char *bf)
const u8 *raw = build_id->data;
size_t i;
+ bf[0] = 0x0;
+
for (i = 0; i < build_id->size; ++i) {
sprintf(bid, "%02x", *raw);
++raw;