Skip to content

Commit 7e893dc

Browse files
Andre-ARMctmarinas
authored andcommitted
kselftest/arm64: mte: fix printf type warnings about __u64
When printing the signal context's PC, we use a "%lx" format specifier, which matches the common userland (glibc's) definition of uint64_t as an "unsigned long". However the structure in question is defined in a kernel uapi header, which uses a self defined __u64 type, and the arm64 kernel headers define this using "int-ll64.h", so it becomes an "unsigned long long". This mismatch leads to the usual compiler warning. The common fix would be to use "PRIx64", but because this is defined by the userland's toolchain libc headers, it wouldn't match as well. Since we know the exact type of __u64, just use "%llx" here instead, to silence this warning. This also fixes a more severe typo: "$lx" is not a valid format specifier. Fixes: 191e678 ("kselftest/arm64: Log unexpected asynchronous MTE faults") Signed-off-by: Andre Przywara <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 0f995f2 commit 7e893dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/arm64/mte/mte_common_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void mte_default_handler(int signum, siginfo_t *si, void *uc)
3838
if (cur_mte_cxt.trig_si_code == si->si_code)
3939
cur_mte_cxt.fault_valid = true;
4040
else
41-
ksft_print_msg("Got unexpected SEGV_MTEAERR at pc=$lx, fault addr=%lx\n",
41+
ksft_print_msg("Got unexpected SEGV_MTEAERR at pc=%llx, fault addr=%lx\n",
4242
((ucontext_t *)uc)->uc_mcontext.pc,
4343
addr);
4444
return;
@@ -64,7 +64,7 @@ void mte_default_handler(int signum, siginfo_t *si, void *uc)
6464
exit(1);
6565
}
6666
} else if (signum == SIGBUS) {
67-
ksft_print_msg("INFO: SIGBUS signal at pc=%lx, fault addr=%lx, si_code=%lx\n",
67+
ksft_print_msg("INFO: SIGBUS signal at pc=%llx, fault addr=%lx, si_code=%x\n",
6868
((ucontext_t *)uc)->uc_mcontext.pc, addr, si->si_code);
6969
if ((cur_mte_cxt.trig_range >= 0 &&
7070
addr >= MT_CLEAR_TAG(cur_mte_cxt.trig_addr) &&

0 commit comments

Comments
 (0)