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-prev] [day] [month] [year] [list]
Message-ID: <ih3rx26fktypyqmqnrkumgdgfwlb5jhyxkjg2xgwy5ea6she63@r7y2oapgjpbc>
Date: Mon, 8 Sep 2025 16:03:58 +0200
From: Jan Kara <jack@...e.cz>
To: Alessandro Zanni <alessandro.zanni87@...il.com>
Cc: shuah@...nel.org, brauner@...nel.org, amir73il@...il.com, 
	jhubbard@...dia.com, jack@...e.cz, mszeredi@...hat.com, 
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/filesystems: Use return value of the function
 'chdir()'

On Thu 10-07-25 02:19:25, Alessandro Zanni wrote:
> Fix to use the return value of the function 'chdir("/")' and check if the
> return is either 0 (ok) or 1 (not ok, so the test stops).
> 
> The patch fies the solves the following errors:
> mount-notify_test.c:468:17: warning: ignoring return value of ‘chdir’
> declared with attribute ‘warn_unused_result’ [-Wunused-result]
>   468 |                 chdir("/");
> 
> mount-notify_test_ns.c:489:17: warning: ignoring return value of
> ‘chdir’ declared with attribute ‘warn_unused_result’ [-Wunused-
> result]
>   489 |                 chdir("/");
> 
> To reproduce the issue, use the command:
> make kselftest TARGET=filesystems/statmount
> 
> Signed-off-by: Alessandro Zanni <alessandro.zanni87@...il.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  .../selftests/filesystems/mount-notify/mount-notify_test.c      | 2 +-
>  .../selftests/filesystems/mount-notify/mount-notify_test_ns.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
> index 5a3b0ace1a88..a7f899599d52 100644
> --- a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
> +++ b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c
> @@ -458,7 +458,7 @@ TEST_F(fanotify, rmdir)
>  	ASSERT_GE(ret, 0);
>  
>  	if (ret == 0) {
> -		chdir("/");
> +		ASSERT_EQ(0, chdir("/"));
>  		unshare(CLONE_NEWNS);
>  		mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL);
>  		umount2("/a", MNT_DETACH);
> diff --git a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c
> index d91946e69591..dc9eb3087a1a 100644
> --- a/tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c
> +++ b/tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c
> @@ -486,7 +486,7 @@ TEST_F(fanotify, rmdir)
>  	ASSERT_GE(ret, 0);
>  
>  	if (ret == 0) {
> -		chdir("/");
> +		ASSERT_EQ(0, chdir("/"));
>  		unshare(CLONE_NEWNS);
>  		mount("", "/", NULL, MS_REC|MS_PRIVATE, NULL);
>  		umount2("/a", MNT_DETACH);
> -- 
> 2.43.0
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ