lkml.org 
[lkml]   [2020]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] perf tools: Initialize output buffer in build_id__sprintf
Hi Jiri,

On Mon, Nov 2, 2020 at 8:31 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> 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>

Thanks
Namhyung


> ---
> tools/perf/util/build-id.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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;
> --
> 2.26.2
>

\
 
 \ /
  Last update: 2020-11-02 14:52    [W:0.053 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site