[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240503030214.86681-8-jhubbard@nvidia.com>
Date: Thu, 2 May 2024 20:02:14 -0700
From: John Hubbard <jhubbard@...dia.com>
To: Shuah Khan <shuah@...nel.org>
Cc: angquan yu <angquan21@...il.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>,
Binbin Wu <binbin.wu@...ux.intel.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Sohil Mehta <sohil.mehta@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Valentin Obst <kernel@...entinobst.de>,
linux-kselftest@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
llvm@...ts.linux.dev,
x86@...nel.org,
John Hubbard <jhubbard@...dia.com>
Subject: [PATCH 7/7] selftests/x86: fix printk() format warnings
First of all, in order to build with clang at all, one must first apply
Valentin Obst's build fix for LLVM [1]. Once that is done, then when
building with clang, via:
make LLVM=1 -C tools/testing/selftests
..clang finds and warns about several cases of using the wrong integer
size in various printk() format strings.
Fix each by matching it with the size of the associated variable.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
Signed-off-by: John Hubbard <jhubbard@...dia.com>
---
tools/testing/selftests/x86/sigreturn.c | 2 +-
tools/testing/selftests/x86/test_vsyscall.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/x86/sigreturn.c b/tools/testing/selftests/x86/sigreturn.c
index 5d7961a5f7f6..0b75b29f794b 100644
--- a/tools/testing/selftests/x86/sigreturn.c
+++ b/tools/testing/selftests/x86/sigreturn.c
@@ -487,7 +487,7 @@ static void sigtrap(int sig, siginfo_t *info, void *ctx_void)
greg_t asm_ss = ctx->uc_mcontext.gregs[REG_CX];
if (asm_ss != sig_ss && sig == SIGTRAP) {
/* Sanity check failure. */
- printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %hx, ax = %llx\n",
+ printf("[FAIL]\tSIGTRAP: ss = %hx, frame ss = %x, ax = %llx\n",
ss, *ssptr(ctx), (unsigned long long)asm_ss);
nerrs++;
}
diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c
index bef6abac331c..63aa3abcd741 100644
--- a/tools/testing/selftests/x86/test_vsyscall.c
+++ b/tools/testing/selftests/x86/test_vsyscall.c
@@ -328,7 +328,7 @@ static int test_getcpu(int cpu)
if (ret_sys == 0) {
if (cpu_sys != cpu) {
- printf("[FAIL]\tsyscall reported CPU %hu but should be %d\n", cpu_sys, cpu);
+ printf("[FAIL]\tsyscall reported CPU %u but should be %d\n", cpu_sys, cpu);
nerrs++;
}
@@ -347,14 +347,14 @@ static int test_getcpu(int cpu)
}
if (cpu_vdso != cpu) {
- printf("[FAIL]\tvDSO reported CPU %hu but should be %d\n", cpu_vdso, cpu);
+ printf("[FAIL]\tvDSO reported CPU %u but should be %d\n", cpu_vdso, cpu);
nerrs++;
} else {
printf("[OK]\tvDSO reported correct CPU\n");
}
if (node_vdso != node) {
- printf("[FAIL]\tvDSO reported node %hu but should be %hu\n", node_vdso, node);
+ printf("[FAIL]\tvDSO reported node %u but should be %u\n", node_vdso, node);
nerrs++;
} else {
printf("[OK]\tvDSO reported correct node\n");
@@ -373,14 +373,14 @@ static int test_getcpu(int cpu)
}
if (cpu_vsys != cpu) {
- printf("[FAIL]\tvsyscall reported CPU %hu but should be %d\n", cpu_vsys, cpu);
+ printf("[FAIL]\tvsyscall reported CPU %u but should be %d\n", cpu_vsys, cpu);
nerrs++;
} else {
printf("[OK]\tvsyscall reported correct CPU\n");
}
if (node_vsys != node) {
- printf("[FAIL]\tvsyscall reported node %hu but should be %hu\n", node_vsys, node);
+ printf("[FAIL]\tvsyscall reported node %u but should be %u\n", node_vsys, node);
nerrs++;
} else {
printf("[OK]\tvsyscall reported correct node\n");
--
2.45.0
Powered by blists - more mailing lists