From: Oleg Nesterov <oleg@redhat.com>
To: Chen Gang <xili_gchen_5257@hotmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"riel@redhat.com" <riel@redhat.com>,
"dave@stgolabs.net" <dave@stgolabs.net>,
"pfeiner@google.com" <pfeiner@google.com>,
"aarcange@redhat.com" <aarcange@redhat.com>,
"vishnu.ps@samsung.com" <vishnu.ps@samsung.com>,
Linux Memory <linux-mm@kvack.org>,
kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/mmap.c: Do not initialize retval in mmap_pgoff()
Date: Mon, 5 Oct 2015 18:30:21 +0200 [thread overview]
Message-ID: <20151005163021.GB19857@redhat.com> (raw)
In-Reply-To: <COL130-W360AE827EAE109246BEB25B9480@phx.gbl>
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@gmail.com>
Acked-by: Oleg Nesterov <oleg@redhat.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2015-10-05 16:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-05 16:24 [PATCH] mm/mmap.c: Do not initialize retval in mmap_pgoff() Chen Gang
2015-10-05 16:30 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151005163021.GB19857@redhat.com \
--to=oleg@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pfeiner@google.com \
--cc=riel@redhat.com \
--cc=vishnu.ps@samsung.com \
--cc=xili_gchen_5257@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).