From: Miaoqian Lin <linmq006@gmail.com>
To: Shuah Khan <shuah@kernel.org>, Miaoqian Lin <linmq006@gmail.com>,
Christian Brauner <brauner@kernel.org>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported()
Date: Fri, 29 Aug 2025 20:29:47 +0800 [thread overview]
Message-ID: <20250829122949.2020530-1-linmq006@gmail.com> (raw)
The function is declared to return bool
but returns -1 on multiple error paths, which is inconsistent and
misleading. Fix this by returning false on all error paths.
Fixes: 8374f43123a5 ("tests: add move_mount(MOVE_MOUNT_SET_GROUP) selftest")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
.../move_mount_set_group_test.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
index bcf51d785a37..3f2c94acb29a 100644
--- a/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
+++ b/tools/testing/selftests/move_mount_set_group/move_mount_set_group_test.c
@@ -197,26 +197,26 @@ static bool move_mount_set_group_supported(void)
if (mount("testing", "/tmp", "tmpfs", MS_NOATIME | MS_NODEV,
"size=100000,mode=700"))
- return -1;
+ return false;
if (mount(NULL, "/tmp", NULL, MS_PRIVATE, 0))
- return -1;
+ return false;
if (mkdir(SET_GROUP_FROM, 0777))
- return -1;
+ return false;
if (mkdir(SET_GROUP_TO, 0777))
- return -1;
+ return false;
if (mount("testing", SET_GROUP_FROM, "tmpfs", MS_NOATIME | MS_NODEV,
"size=100000,mode=700"))
- return -1;
+ return false;
if (mount(SET_GROUP_FROM, SET_GROUP_TO, NULL, MS_BIND, NULL))
- return -1;
+ return false;
if (mount(NULL, SET_GROUP_FROM, NULL, MS_SHARED, 0))
- return -1;
+ return false;
ret = syscall(__NR_move_mount, AT_FDCWD, SET_GROUP_FROM,
AT_FDCWD, SET_GROUP_TO, MOVE_MOUNT_SET_GROUP);
--
2.35.1
reply other threads:[~2025-08-29 12:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250829122949.2020530-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ptikhomirov@virtuozzo.com \
--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;
as well as URLs for NNTP newsgroup(s).