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: <a2627c06-6d09-0522-1d73-7f09ffb44a27@oracle.com>
Date:   Mon, 8 Feb 2021 17:33:23 -0800
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Miaohe Lin <linmiaohe@...wei.com>, akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hugetlbfs: Remove unneeded return value of
 hugetlb_vmtruncate()

On 2/8/21 12:46 AM, Miaohe Lin wrote:
> The function hugetlb_vmtruncate() is guaranteed to always success since
> commit 7aa91e104028 ("hugetlb: allow extending ftruncate on hugetlbfs").
> So we should remove the unneeded return value which is always 0.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> ---
>  fs/hugetlbfs/inode.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Thanks,
Reviewed-by: Mike Kravetz <mike.kravetz@...cle.com>
-- 
Mike Kravetz

> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 394da2ab08ad..701c82c36138 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -567,7 +567,7 @@ static void hugetlbfs_evict_inode(struct inode *inode)
>  	clear_inode(inode);
>  }
>  
> -static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
> +static void hugetlb_vmtruncate(struct inode *inode, loff_t offset)
>  {
>  	pgoff_t pgoff;
>  	struct address_space *mapping = inode->i_mapping;
> @@ -582,7 +582,6 @@ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
>  		hugetlb_vmdelete_list(&mapping->i_mmap, pgoff, 0);
>  	i_mmap_unlock_write(mapping);
>  	remove_inode_hugepages(inode, offset, LLONG_MAX);
> -	return 0;
>  }
>  
>  static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
> @@ -781,9 +780,7 @@ static int hugetlbfs_setattr(struct user_namespace *mnt_userns,
>  		if ((newsize < oldsize && (info->seals & F_SEAL_SHRINK)) ||
>  		    (newsize > oldsize && (info->seals & F_SEAL_GROW)))
>  			return -EPERM;
> -		error = hugetlb_vmtruncate(inode, newsize);
> -		if (error)
> -			return error;
> +		hugetlb_vmtruncate(inode, newsize);
>  	}
>  
>  	setattr_copy(&init_user_ns, inode, attr);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ