Re: [PATCH] fs-verity: use kmap_local_page() instead of kmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, August 19, 2022 12:40:10 AM CEST Eric Biggers wrote:
> From: Eric Biggers <ebiggers@xxxxxxxxxx>
> 
> Convert the use of kmap() to its recommended replacement
> kmap_local_page().  This avoids the overhead of doing a non-local
> mapping, which is unnecessary in this case.
> 
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>  fs/verity/read_metadata.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

It looks good to me...

Reviewed-by: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx>

Thanks,

Fabio

> diff --git a/fs/verity/read_metadata.c b/fs/verity/read_metadata.c
> index 6ee849dc7bc183..2aefc5565152ad 100644
> --- a/fs/verity/read_metadata.c
> +++ b/fs/verity/read_metadata.c
> @@ -53,14 +53,14 @@ static int fsverity_read_merkle_tree(struct inode 
*inode,
>  			break;
>  		}
>  
> -		virt = kmap(page);
> +		virt = kmap_local_page(page);
>  		if (copy_to_user(buf, virt + offs_in_page, 
bytes_to_copy)) {
> -			kunmap(page);
> +			kunmap_local(virt);
>  			put_page(page);
>  			err = -EFAULT;
>  			break;
>  		}
> -		kunmap(page);
> +		kunmap_local(virt);
>  		put_page(page);
>  
>  		retval += bytes_to_copy;
> 
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
> prerequisite-patch-id: 188e114bdf3546eb18e7984b70be8a7c773acec3
> -- 
> 2.37.1
> 
> 







[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux