Skip to contentSkip to conversation

syscalls/statx01: Fix reading 64-bit mnt_id value from mountinfo on i586

PATCH In review Vitaly Chikunov 2 participants 2 messages Nov 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/statx01: Fix reading 64-bit mnt_id value from mountinfo on i586

Fix sscanf format flag for 'uint64_t mnt_id'. Reading 'uint64_t' as '%ld' causes intermittent false positive test error:

statx01.c:82: TFAIL: statx.stx_mnt_id(23) is different from mount_id(13820440305888919575) in /proc/self/mountinfo

because that way 'mnt_id' is filled incompletely on 32-bit architectures.

---
 testcases/kernel/syscalls/statx/statx01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/statx/statx01.c +1 -1
index 24c5e9758..60b50958b 100644
@@ -65,7 +65,7 @@ static void test_mnt_id(struct statx *buf)
 	file = SAFE_FOPEN("/proc/self/mountinfo", "r");
 
 	while (fgets(line, sizeof(line), file)) {
-		if (sscanf(line, "%ld %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
+		if (sscanf(line, "%"SCNu64" %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
 			continue;
 
 		if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
Signature · 5 lines
2.33.4


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp