[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250829122949.2020530-1-linmq006@gmail.com>
Date: Fri, 29 Aug 2025 20:29:47 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Shuah Khan <shuah@...nel.org>,
Miaoqian Lin <linmq006@...il.com>,
Christian Brauner <brauner@...nel.org>,
Pavel Tikhomirov <ptikhomirov@...tuozzo.com>,
linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported()
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@...il.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
Powered by blists - more mailing lists