lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240610200909.55819-1-jain.abhinav177@gmail.com>
Date: Mon, 10 Jun 2024 20:09:09 +0000
From: Abhinav Jain <jain.abhinav177@...il.com>
To: shuah@...nel.org,
	brauner@...nel.org,
	mszeredi@...hat.com,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: skhan@...uxfoundation.org,
	javier.carrasco.cruz@...il.com,
	jain.abhinav177@...il.com
Subject: [PATCH] selftests: filesystems: add return value checks

Add ksft_exit_fail_msg() return value checks for fchdir() & chroot()
to address the selftests statmount test compile warnings

statmount_test.c:127:2: warning: ignoring return value of ‘fchdir’,
declared with attribute warn_unused_result [-Wunused-result]
  127 |  fchdir(orig_root);
      |  ^~~~~~~~~~~~~~~~~
statmount_test.c:128:2: warning: ignoring return value of ‘chroot’,
declared with attribute warn_unused_result [-Wunused-result]
  128 |  chroot(".");
      |  ^~~~~~~~~~~

Signed-off-by: Abhinav Jain <jain.abhinav177@...il.com>
---
 .../filesystems/statmount/statmount_test.c          | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/filesystems/statmount/statmount_test.c b/tools/testing/selftests/filesystems/statmount/statmount_test.c
index e6d7c4f1c85b..b5e1247233b6 100644
--- a/tools/testing/selftests/filesystems/statmount/statmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/statmount_test.c
@@ -125,8 +125,17 @@ static uint32_t old_root_id, old_parent_id;
 
 static void cleanup_namespace(void)
 {
-	fchdir(orig_root);
-	chroot(".");
+	int ret;
+
+	ret = fchdir(orig_root);
+	if (ret == -1)
+		ksft_exit_fail_msg("changing current directory: %s\n",
+				strerror(errno));
+
+	ret = chroot(".");
+	if (ret == -1)
+		ksft_exit_fail_msg("chroot: %s\n", strerror(errno));
+
 	umount2(root_mntpoint, MNT_DETACH);
 	rmdir(root_mntpoint);
 }
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ