]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests: harness: fix printing of mismatch values in __EXPECT()
authorDmitry V. Levin <ldv@strace.io>
Wed, 8 Jan 2025 17:07:57 +0000 (19:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:49:58 +0000 (12:49 +0100)
commit23b54d193a90fdde31723de51641504c22cc627c
treeb7a5c843ce694de8f6d53f1bf64625ce53a86d03
parent28063f72460dd8105ffc158c1eed4fc04812fe26
selftests: harness: fix printing of mismatch values in __EXPECT()

[ Upstream commit 02bc220dc6dc7c56edc4859bc5dd2c08b95d5fb5 ]

intptr_t and uintptr_t are not big enough types on 32-bit architectures
when printing 64-bit values, resulting to the following incorrect
diagnostic output:

  # get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (3134324433)

Replace intptr_t and uintptr_t with intmax_t and uintmax_t, respectively.
With this fix, the same test produces more usable diagnostic output:

  # get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (18446744072548908753)

Link: https://lore.kernel.org/r/20250108170757.GA6723@strace.io
Fixes: b5bb6d3068ea ("selftests/seccomp: fix 32-bit build warnings")
Signed-off-by: Dmitry V. Levin <ldv@strace.io>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/kselftest_harness.h