From: Stephen Brennan <stephen.s.brennan@oracle.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Alan Maguire <alan.maguire@oracle.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Clark Williams <williams@redhat.com>,
dwarves@vger.kernel.org, bpf@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH v1 1/1] btf_encoder: Print the u32 overflow check offset as a u64
Date: Tue, 1 Dec 2026 11:08:35 -0800 [thread overview]
Message-ID: <f821edba-a2fa-426d-8b5f-8cda288bf4ec@oracle.com> (raw)
In-Reply-To: <20261201183006.401544-1-acme@kernel.org>
On 12/1/26 10:30 AM, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> The offset ignored in btf_encoder__encode_cu_variables() is a uint64_t,
> printed with %zu. That matches on 64-bit, where size_t is also 64-bit,
> but on 32-bit x86 uint64_t is unsigned long long and gcc rejects it:
>
> btf_encoder.c:2893:88: error: format '%zu' expects argument of type
> 'size_t', but argument 4 has type 'uint64_t' [-Werror=format=]
>
> which breaks a Debug (-Werror) build on i386 since that check was added.
> Use PRIu64, inttypes.h is already included.
>
> Fixes: 5b5238c0aaff1dfd ("btf_encoder: Explicitly check addr/size for u32 overflow")
> Cc: Alan Maguire <alan.maguire@oracle.com>
> Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
There's some irony that this print happens in the 32-bit overflow case,
so I should have thought about what happens when size_t is 32-bit.
Thanks for fixing this.
Reviewed-by: Stephen Brennan <stephen.s.brennan@oracle.com>
> ---
> btf_encoder.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/btf_encoder.c b/btf_encoder.c
> index 85376281da076cb2..ca102eb194b80f8d 100644
> --- a/btf_encoder.c
> +++ b/btf_encoder.c
> @@ -2890,7 +2890,7 @@ static int btf_encoder__encode_cu_variables(struct btf_encoder *encoder)
> }
> if (addr > UINT32_MAX) {
> if (encoder->verbose)
> - fprintf(stderr, "Ignoring variable '%s' - its offset %zu doesn't fit in a u32\n",
> + fprintf(stderr, "Ignoring variable '%s' - its offset %" PRIu64 " doesn't fit in a u32\n",
> name, addr);
> continue;
> }
prev parent reply other threads:[~2026-12-01 19:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 18:30 [PATCH v1 1/1] btf_encoder: Print the u32 overflow check offset as a u64 Arnaldo Carvalho de Melo
2026-12-01 19:08 ` Stephen Brennan [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=f821edba-a2fa-426d-8b5f-8cda288bf4ec@oracle.com \
--to=stephen.s.brennan@oracle.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=alan.maguire@oracle.com \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=williams@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.