public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Cyril Hrubis <chrubis@suse.cz>, LTP List <ltp@lists.linux.it>
Cc: "Dmitry V . Levin" <ldv@altlinux.org>
Subject: [LTP] [PATCH] syscalls/statx01: Fix reading 64-bit mnt_id value from mountinfo on i586
Date: Fri,  4 Nov 2022 02:30:18 +0300	[thread overview]
Message-ID: <20221103233018.62846-1-vt@altlinux.org> (raw)

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.

Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 testcases/kernel/syscalls/statx/statx01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 24c5e9758..60b50958b 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -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)
-- 
2.33.4


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

             reply	other threads:[~2022-11-04 12:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 23:30 Vitaly Chikunov [this message]
2022-11-04 13:44 ` [LTP] [PATCH] syscalls/statx01: Fix reading 64-bit mnt_id value from mountinfo on i586 Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221103233018.62846-1-vt@altlinux.org \
    --to=vt@altlinux.org \
    --cc=chrubis@suse.cz \
    --cc=ldv@altlinux.org \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox