lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241009085751.35976-1-tianjia.zhang@linux.alibaba.com>
Date: Wed,  9 Oct 2024 16:57:51 +0800
From: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
To: Marc Zyngier <maz@...nel.org>,
	Oliver Upton <oliver.upton@...ux.dev>,
	Joey Gouly <joey.gouly@....com>,
	Suzuki K Poulose <suzuki.poulose@....com>,
	Zenghui Yu <yuzenghui@...wei.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>,
	Nathan Chancellor <nathan@...nel.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Bill Wendling <morbo@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Pierre-Clément Tosi <ptosi@...gle.com>,
	linux-arm-kernel@...ts.infradead.org,
	kvmarm@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Cc: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
Subject: [PATCH] KVM: arm64: nVHE: gen-hyprel: Silent build warnings

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@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ