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: <7914003.lOV4Wx5bFT@fdefranc-mobl3>
Date:   Thu, 14 Dec 2023 12:51:35 +0100
From:   "Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>
To:     linux-fsdevel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] minixfs: use offset_in_page()

On Wednesday, 13 December 2023 01:08:46 CET Al Viro wrote:
> It's cheaper and more idiomatic than subtracting page_address()
> of the corresponding page...
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  fs/minix/dir.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)

Well, I know this code since the changes to fs/sysv and fs/ext2 ;)
Therefore, FWIW...

Reviewed-by: Fabio M. De Francesco <fabio.maria.de.francesco@...ux.intel.com>

Fabio

> diff --git a/fs/minix/dir.c b/fs/minix/dir.c
> index 62c313fc9a49..34a5d17f0796 100644
> --- a/fs/minix/dir.c
> +++ b/fs/minix/dir.c
> @@ -268,7 +268,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) return -EINVAL;
> 
>  got_it:
> -	pos = page_offset(page) + p - (char *)page_address(page);
> +	pos = page_offset(page) + offset_in_page(p);
>  	err = minix_prepare_chunk(page, pos, sbi->s_dirsize);
>  	if (err)
>  		goto out_unlock;
> @@ -296,8 +296,7 @@ int minix_add_link(struct dentry *dentry, struct inode
> *inode) int minix_delete_entry(struct minix_dir_entry *de, struct page
> *page) {
>  	struct inode *inode = page->mapping->host;
> -	char *kaddr = page_address(page);
> -	loff_t pos = page_offset(page) + (char*)de - kaddr;
> +	loff_t pos = page_offset(page) + offset_in_page(de);
>  	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
>  	unsigned len = sbi->s_dirsize;
>  	int err;
> @@ -421,8 +420,7 @@ int minix_set_link(struct minix_dir_entry *de, struct
> page *page, {
>  	struct inode *dir = page->mapping->host;
>  	struct minix_sb_info *sbi = minix_sb(dir->i_sb);
> -	loff_t pos = page_offset(page) +
> -			(char *)de-(char*)page_address(page);
> +	loff_t pos = page_offset(page) + offset_in_page(de);
>  	int err;
> 
>  	lock_page(page);




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ