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]
Date:   Mon, 23 May 2022 00:04:43 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Vasily Averin <vvs@...nvz.org>
Cc:     Christoph Hellwig <hch@...radead.org>, kernel@...nvz.org,
        linux-kernel@...r.kernel.org,
        Christian Brauner <brauner@...nel.org>,
        Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v3] fs/proc/base.c: fix incorrect fmode_t casts

On Sun, May 22, 2022 at 03:08:42PM +0300, Vasily Averin wrote:
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index c1031843cc6a..4e4edf9db5f0 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2237,13 +2237,13 @@ static struct dentry *
>  proc_map_files_instantiate(struct dentry *dentry,
>  			   struct task_struct *task, const void *ptr)
>  {
> -	fmode_t mode = (fmode_t)(unsigned long)ptr;
> +	const fmode_t *mode = ptr;

Why not ...

	fmode_t mode = *(fmode_t *)ptr;

and then you don't need

> -				    ((mode & FMODE_READ ) ? S_IRUSR : 0) |
> -				    ((mode & FMODE_WRITE) ? S_IWUSR : 0));
> +				    ((*mode & FMODE_READ ) ? S_IRUSR : 0) |
> +				    ((*mode & FMODE_WRITE) ? S_IWUSR : 0));

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ