[LTP] [PATCH 1/2] syscalls/statx01: Fix compiler warning because of PRIu64

Yang Xu xuyang2018.jy@fujitsu.com
Fri Nov 19 09:28:41 CET 2021


warning: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 5 has type ‘__u64’ {aka ‘long long unsigned int’}

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/statx/statx01.c | 8 ++++----
 testcases/kernel/syscalls/statx/statx02.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 2358dd7bc..1289366b9 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -79,11 +79,11 @@ static void test_normal_file(void)
 
 	if (buff.stx_size == SIZE)
 		tst_res(TPASS,
-			"stx_size(%"PRIu64") is correct", buff.stx_size);
+			"stx_size(%"PRIu64") is correct", (uint64_t)buff.stx_size);
 	else
 		tst_res(TFAIL,
 			"stx_size(%"PRIu64") is different from expected(%u)",
-			buff.stx_size, SIZE);
+			(uint64_t)buff.stx_size, SIZE);
 
 	if ((buff.stx_mode & ~(S_IFMT)) == MODE)
 		tst_res(TPASS, "stx_mode(%u) is correct", buff.stx_mode);
@@ -94,10 +94,10 @@ static void test_normal_file(void)
 
 	if (buff.stx_blocks <= buff.stx_blksize/512 * 2)
 		tst_res(TPASS, "stx_blocks(%"PRIu64") is valid",
-			buff.stx_blocks);
+			(uint64_t)buff.stx_blocks);
 	else
 		tst_res(TFAIL, "stx_blocks(%"PRIu64") is invalid",
-			buff.stx_blocks);
+			(uint64_t)buff.stx_blocks);
 
 }
 
diff --git a/testcases/kernel/syscalls/statx/statx02.c b/testcases/kernel/syscalls/statx/statx02.c
index 08ea940cb..63133a3b7 100644
--- a/testcases/kernel/syscalls/statx/statx02.c
+++ b/testcases/kernel/syscalls/statx/statx02.c
@@ -50,11 +50,11 @@ static void test_empty_path(void)
 
 	if (buf.stx_size == SIZE)
 		tst_res(TPASS,
-			"stx_size(%"PRIu64") is correct", buf.stx_size);
+			"stx_size(%"PRIu64") is correct", (uint64_t)buf.stx_size);
 	else
 		tst_res(TFAIL,
 			"stx_size(%"PRIu64") is not same as expected(%u)",
-			buf.stx_size, SIZE);
+			(uint64_t)buf.stx_size, SIZE);
 
 }
 
-- 
2.23.0



More information about the ltp mailing list