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] [thread-next>] [day] [month] [year] [list]
Message-ID: <07f4ba23-cf4c-6817-f7a4-5428f35d966c@linuxfoundation.org>
Date:   Fri, 3 Dec 2021 11:26:13 -0700
From:   Shuah Khan <skhan@...uxfoundation.org>
To:     davidcomponentone@...il.com, shuah@...nel.org
Cc:     linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>,
        Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] mnt: remove unneeded conversion to bool

On 11/24/21 5:56 PM, davidcomponentone@...il.com wrote:
> From: Yang Guang <yang.guang5@....com.cn>
> 
> The coccinelle report
> ./tools/testing/selftests/mount/unprivileged-remount-test.c:285:54-59:
> WARNING: conversion to bool not needed here
> ./tools/testing/selftests/mount/unprivileged-remount-test.c:207:54-59:
> WARNING: conversion to bool not needed here
> Relational and logical operators evaluate to bool,
> explicit conversion is overly verbose and unneeded.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Yang Guang <yang.guang5@....com.cn>
> ---
>   tools/testing/selftests/mount/unprivileged-remount-test.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
> index 584dc6bc3b06..d2917054fe3a 100644
> --- a/tools/testing/selftests/mount/unprivileged-remount-test.c
> +++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
> @@ -204,7 +204,7 @@ bool test_unpriv_remount(const char *fstype, const char *mount_options,
>   		if (!WIFEXITED(status)) {
>   			die("child did not terminate cleanly\n");
>   		}
> -		return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false;
> +		return WEXITSTATUS(status) == EXIT_SUCCESS;
>   	}
>   
>   	create_and_enter_userns();
> @@ -282,7 +282,7 @@ static bool test_priv_mount_unpriv_remount(void)
>   		if (!WIFEXITED(status)) {
>   			die("child did not terminate cleanly\n");
>   		}
> -		return WEXITSTATUS(status) == EXIT_SUCCESS ? true : false;
> +		return WEXITSTATUS(status) == EXIT_SUCCESS;
>   	}
>   
>   	orig_mnt_flags = read_mnt_flags(orig_path);
> 

This change doesn't look right. WEXITSTATUS(status) return could be
> 1 or 0 or negative.

thanks,
-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ