From: Sasha Levin <sashal@kernel.org>
To: "Mickaël Salaün" <mic@digikod.net>
Cc: "Günther Noack" <gnoack@google.com>,
"Shuah Khan" <shuah@kernel.org>,
linux-security-module@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/landlock: print st_ino as unsigned long long
Date: Tue, 3 Nov 2026 10:55:12 -0500 [thread overview]
Message-ID: <20261103155512.535137-1-sashal@kernel.org> (raw)
On 32-bit architectures with a 64-bit ino_t, st_ino is an unsigned long
long, and printing it with %lu warns:
fs_test.c:10511:57: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type '__ino64_t' {aka 'long long unsigned int'} [-Wformat=]
Cast it to unsigned long long and print it with %llu.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with a 32-bit build of the selftests with a 64-bit time_t (gcc 16
and clang 21 with -m32 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64);
KernelCI's 32-bit arm builds show the same warnings. The changed files
build without format warnings there now, and the x86_64 builds don't
change. The other selftests get the same kind of fix in separate
patches.
tools/testing/selftests/landlock/fs_test.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
index f725882fa4a78..a2dc9a7f0481a 100644
--- a/tools/testing/selftests/landlock/fs_test.c
+++ b/tools/testing/selftests/landlock/fs_test.c
@@ -10508,7 +10508,8 @@ TEST_F(trace_layout1, check_rule_fs_fields)
ASSERT_EQ(0, stat(dir_s1d1, &dir_stat));
snprintf(expected_dev, sizeof(expected_dev), "%u:%u",
major(dir_stat.st_dev), minor(dir_stat.st_dev));
- snprintf(expected_ino, sizeof(expected_ino), "%lu", dir_stat.st_ino);
+ snprintf(expected_ino, sizeof(expected_ino), "%llu",
+ (unsigned long long)dir_stat.st_ino);
set_cap(_metadata, CAP_DAC_OVERRIDE);
ASSERT_EQ(0, tracefs_clear());
--
2.53.0
next reply other threads:[~2026-11-03 15:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 15:55 Sasha Levin [this message]
2026-11-03 20:34 ` Günther Noack
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=20261103155512.535137-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gnoack@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=shuah@kernel.org \
/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
all inboxes | Powered by JetHome®