linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported()
@ 2025-08-29 12:29 Miaoqian Lin
  0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2025-08-29 12:29 UTC (permalink / raw)
  To: Shuah Khan, Miaoqian Lin, Christian Brauner, Pavel Tikhomirov,
	linux-kselftest, linux-kernel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-29 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 12:29 [PATCH] selftests/move_mount_set_group: fix inconsistent return type in move_mount_set_group_supported() Miaoqian Lin

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).