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: <20240311162406.7vc64qbta24psk3j@quack3>
Date: Mon, 11 Mar 2024 17:24:06 +0100
From: Jan Kara <jack@...e.cz>
To: Kees Cook <keescook@...omium.org>
Cc: Eric Biederman <ebiederm@...ssion.com>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
	linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] exec: Simplify remove_arg_zero() error path

On Sat 09-03-24 13:48:30, Kees Cook wrote:
> We don't need the "out" label any more, so remove "ret" and return
> directly on error.
> 
> Signed-off-by: Kees Cook <keescook@...omium.org>

Looks good. Feel free to add:

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

								Honza

> ---
> Cc: Eric Biederman <ebiederm@...ssion.com>
> Cc: Alexander Viro <viro@...iv.linux.org.uk>
> Cc: Christian Brauner <brauner@...nel.org>
> Cc: Jan Kara <jack@...e.cz>
> Cc: linux-mm@...ck.org
> Cc: linux-fsdevel@...r.kernel.org
> ---
>  fs/exec.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/exec.c b/fs/exec.c
> index 715e1a8aa4f0..e7d9d6ad980b 100644
> --- a/fs/exec.c
> +++ b/fs/exec.c
> @@ -1720,7 +1720,6 @@ static int prepare_binprm(struct linux_binprm *bprm)
>   */
>  int remove_arg_zero(struct linux_binprm *bprm)
>  {
> -	int ret = 0;
>  	unsigned long offset;
>  	char *kaddr;
>  	struct page *page;
> @@ -1731,10 +1730,8 @@ int remove_arg_zero(struct linux_binprm *bprm)
>  	do {
>  		offset = bprm->p & ~PAGE_MASK;
>  		page = get_arg_page(bprm, bprm->p, 0);
> -		if (!page) {
> -			ret = -EFAULT;
> -			goto out;
> -		}
> +		if (!page)
> +			return -EFAULT;
>  		kaddr = kmap_local_page(page);
>  
>  		for (; offset < PAGE_SIZE && kaddr[offset];
> @@ -1748,8 +1745,7 @@ int remove_arg_zero(struct linux_binprm *bprm)
>  	bprm->p++;
>  	bprm->argc--;
>  
> -out:
> -	return ret;
> +	return 0;
>  }
>  EXPORT_SYMBOL(remove_arg_zero);
>  
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ