From: James Clark <james.clark@linaro.org>
To: Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf build-id: Fix wrong return value checking
Date: Tue, 21 Apr 2026 15:33:08 +0100 [thread overview]
Message-ID: <d350c96d-8a1f-47cb-bdc2-355ca0dfa2c1@linaro.org> (raw)
In-Reply-To: <20260420180858.129075-1-namhyung@kernel.org>
On 20/04/2026 19:08, Namhyung Kim wrote:
> The {sysfs,filename}__snprintf_build_id() both return the actual length
> of build-ID. But in their fprintf counterparts check with sbuild_id
> length which contain a terminating NUL bytes. So they cannot match.
>
> This resulted in perf buildid-list -k prints nothing. With this fix,
> it can show the following result.
>
> $ perf buildid-list -k
> 9524074000cb36cf2559a5b52f0555dab47da553
>
> Fixes: fccaaf6fbbc59910e ("perf build-id: Change sprintf functions to snprintf")
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: James Clark <james.clark@linaro.org>
> ---
> tools/perf/builtin-buildid-list.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
> index a91bbb34ac946360..8ad39ff9a4b8a4b4 100644
> --- a/tools/perf/builtin-buildid-list.c
> +++ b/tools/perf/builtin-buildid-list.c
> @@ -61,7 +61,7 @@ static int sysfs__fprintf_build_id(FILE *fp)
> int ret;
>
> ret = sysfs__snprintf_build_id("/", sbuild_id, sizeof(sbuild_id));
> - if (ret != sizeof(sbuild_id))
> + if (ret != sizeof(sbuild_id) - 1)
> return ret < 0 ? ret : -EINVAL;
>
> return fprintf(fp, "%s\n", sbuild_id);
> @@ -73,7 +73,7 @@ static int filename__fprintf_build_id(const char *name, FILE *fp)
> int ret;
>
> ret = filename__snprintf_build_id(name, sbuild_id, sizeof(sbuild_id));
> - if (ret != sizeof(sbuild_id))
> + if (ret != sizeof(sbuild_id) - 1)
> return ret < 0 ? ret : -EINVAL;
>
> return fprintf(fp, "%s\n", sbuild_id);
prev parent reply other threads:[~2026-04-21 14:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 18:08 [PATCH] perf build-id: Fix wrong return value checking Namhyung Kim
2026-04-21 0:30 ` sashiko-bot
2026-04-22 7:12 ` Namhyung Kim
2026-04-21 14:33 ` James Clark [this message]
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=d350c96d-8a1f-47cb-bdc2-355ca0dfa2c1@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox