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] [day] [month] [year] [list]
Message-ID: <20151005163021.GB19857@redhat.com>
Date:	Mon, 5 Oct 2015 18:30:21 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Chen Gang <xili_gchen_5257@...mail.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
	"riel@...hat.com" <riel@...hat.com>,
	"dave@...olabs.net" <dave@...olabs.net>,
	"pfeiner@...gle.com" <pfeiner@...gle.com>,
	"aarcange@...hat.com" <aarcange@...hat.com>,
	"vishnu.ps@...sung.com" <vishnu.ps@...sung.com>,
	Linux Memory <linux-mm@...ck.org>,
	kernel mailing list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Do not initialize retval in mmap_pgoff()

On 10/06, Chen Gang wrote:
>
> When fget() fails, can return -EBADF directly.

To me this change actually makes the code more readable and clean.

> Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>

Acked-by: Oleg Nesterov <oleg@...hat.com>

> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1412,13 +1412,13 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
>  		unsigned long, fd, unsigned long, pgoff)
>  {
>  	struct file *file = NULL;
> -	unsigned long retval = -EBADF;
> +	unsigned long retval;
>  
>  	if (!(flags & MAP_ANONYMOUS)) {
>  		audit_mmap_fd(fd, flags);
>  		file = fget(fd);
>  		if (!file)
> -			goto out;
> +			return -EBADF;
>  		if (is_file_hugepages(file))
>  			len = ALIGN(len, huge_page_size(hstate_file(file)));
>  		retval = -EINVAL;
> @@ -1453,7 +1453,6 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
>  out_fput:
>  	if (file)
>  		fput(file);
> -out:
>  	return retval;
>  }
>  
> -- 
> 1.9.3
> 
>  		 	   		  

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ