diff options
author | Jiri Olsa | 2020-11-02 00:31:02 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo | 2020-11-03 09:14:45 -0300 |
commit | 6311951d4f8f28c43b554ff0719027884bedd7e3 (patch) | |
tree | 75f2db97d40d52fdd64b4fad34ff48ddd1a106b4 /tools/perf | |
parent | 86449b12f626a65d2a2ecfada1e024488471f9e2 (diff) |
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')
-rw-r--r-- | tools/perf/util/build-id.c | 2 |
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; |