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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 29 Sep 2017 10:42:31 -0700
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Anshuman Khandual <khandual@...ux.vnet.ibm.com>,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:     nyc@...omorphy.com, Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from
 hugetlbfs_setattr()

Adding akpm on Cc:

On 09/29/2017 07:54 AM, Anshuman Khandual wrote:
> There is no need to have a local return code set with -EINVAL when both the
> conditions following it return error codes appropriately. Just remove the
> redundant one.
> 
> Signed-off-by: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
> ---
>  fs/hugetlbfs/inode.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 59073e9..cff3939 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -668,7 +668,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
>  		return error;
>  
>  	if (ia_valid & ATTR_SIZE) {
> -		error = -EINVAL;
>  		if (attr->ia_size & ~huge_page_mask(h))
>  			return -EINVAL;
>  		error = hugetlb_vmtruncate(inode, attr->ia_size);
> 

Thanks for noticing.
I would hope the compiler is smarter than the code and optimize this away.

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

-- 
Mike Kravetz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ