All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: 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>,
	Stephen Brennan <stephen.s.brennan@oracle.com>
Subject: [PATCH v1 1/1] btf_encoder: Print the u32 overflow check offset as a u64
Date: Tue,  1 Dec 2026 15:30:06 -0300	[thread overview]
Message-ID: <20261201183006.401544-1-acme@kernel.org> (raw)

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>
---
 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;
 		}
-- 
2.56.0


             reply	other threads:[~2026-12-01 18:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 18:30 Arnaldo Carvalho de Melo [this message]
2026-12-01 19:08 ` [PATCH v1 1/1] btf_encoder: Print the u32 overflow check offset as a u64 Stephen Brennan

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=20261201183006.401544-1-acme@kernel.org \
    --to=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=stephen.s.brennan@oracle.com \
    --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.