linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: nVHE: gen-hyprel: Silent build warnings
@ 2024-10-09  8:57 Tianjia Zhang
  2024-10-09 11:07 ` Marc Zyngier
  2024-10-16  6:19 ` kernel test robot
  0 siblings, 2 replies; 8+ messages in thread
From: Tianjia Zhang @ 2024-10-09  8:57 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, Joey Gouly, Suzuki K Poulose,
	Zenghui Yu, Catalin Marinas, Will Deacon, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	Pierre-Clément Tosi, linux-arm-kernel, kvmarm, linux-kernel,
	llvm
  Cc: Tianjia Zhang

This patch silent the some mismatch format build warnings
with clang, like:

  arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:233:2: warning: format specifies
  type 'unsigned long' but the argument has type 'Elf64_Off'
  (aka 'unsigned long long') [-Wformat]
    233 |         assert_ne(off, 0UL, "%lu");
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
        |                              %llu
  arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:193:34: note: expanded from macro 'assert_ne'
    193 | #define assert_ne(lhs, rhs, fmt)        assert_op(lhs, rhs, fmt, !=)
        |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:188:19: note: expanded from macro 'assert_op'
    187 |                                 " failed (lhs=" fmt ", rhs=" fmt        \
        |                                                 ~~~
    188 |                                 ", line=%d)", _lhs, _rhs, __LINE__);    \
        |                                               ^~~~
  arch/arm64/kvm/hyp/nvhe/gen-hyprel.c:167:17: note: expanded from macro 'fatal_error'
    166 |                 fprintf(stderr, "error: %s: " fmt "\n",                 \
        |                                               ~~~
    167 |                         elf.path, ## __VA_ARGS__);                      \
        |                                      ^~~~~~~~~~~

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 arch/arm64/kvm/hyp/nvhe/gen-hyprel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c
index b63f4e1c1033..0d916d91b13c 100644
--- a/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c
+++ b/arch/arm64/kvm/hyp/nvhe/gen-hyprel.c
@@ -230,7 +230,7 @@ static inline const char *section_begin(Elf64_Shdr *shdr)
 /* Find a section by its offset from the beginning of the file. */
 static inline Elf64_Shdr *section_by_off(Elf64_Off off)
 {
-	assert_ne(off, 0UL, "%lu");
+	assert_ne(off, 0ULL, "%llu");
 	return elf_ptr(Elf64_Shdr, off);
 }
 
@@ -276,7 +276,7 @@ static void init_elf(const char *path)
 	close(fd);
 
 	/* Get pointer to the ELF header. */
-	assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu");
+	assert_ge(stat.st_size, (off_t)sizeof(*elf.ehdr), "%llu");
 	elf.ehdr = elf_ptr(Elf64_Ehdr, 0);
 
 	/* Check the ELF magic. */
@@ -340,7 +340,7 @@ static void emit_rela_abs64(Elf64_Rela *rela, const char *sh_orig_name)
 	 * a symbol at the beginning of the relocated section, and <offset>
 	 * is `rela->r_offset`.
 	 */
-	printf(".reloc %lu, R_AARCH64_PREL32, %s%s + 0x%lx\n",
+	printf(".reloc %lu, R_AARCH64_PREL32, %s%s + 0x%llx\n",
 	       reloc_offset, HYP_SECTION_SYMBOL_PREFIX, sh_orig_name,
 	       elf64toh(rela->r_offset));
 
@@ -376,7 +376,7 @@ static void emit_rela_section(Elf64_Shdr *sh_rela)
 		uint32_t type = (uint32_t)elf64toh(rela->r_info);
 
 		/* Check that rela points inside the relocated section. */
-		assert_lt(elf64toh(rela->r_offset), elf64toh(sh_orig->sh_size), "0x%lx");
+		assert_lt(elf64toh(rela->r_offset), elf64toh(sh_orig->sh_size), "0x%llx");
 
 		switch (type) {
 		/*
-- 
2.47.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-16  6:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09  8:57 [PATCH] KVM: arm64: nVHE: gen-hyprel: Silent build warnings Tianjia Zhang
2024-10-09 11:07 ` Marc Zyngier
2024-10-10  8:12   ` tianjia.zhang
2024-10-10 13:03     ` Marc Zyngier
2024-10-14  6:31       ` tianjia.zhang
2024-10-10 15:23     ` Nick Desaulniers
2024-10-14  6:50       ` tianjia.zhang
2024-10-16  6:19 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).