From: Gaowei Pu <pugaowei@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>, linux-mm@kvack.org
Subject: [PATCH] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area
Date: Thu, 10 Oct 2019 11:31:17 +0800 [thread overview]
Message-ID: <20191010033117.22294-1-pugaowei@gmail.com> (raw)
get_unmapped_area already cover the offset_in_page() check and returned
with error ptr. So replace offset_in_page() with IS_ERR_VALUE().
Signed-off-by: Gaowei Pu <pugaowei@gmail.com>
---
mm/mmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 7e8c3e8ae75f..66cd88b2abb7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1430,7 +1430,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
* that it represents a valid section of the address space.
*/
addr = get_unmapped_area(file, addr, len, pgoff, flags);
- if (offset_in_page(addr))
+ if (IS_ERR_VALUE(addr))
return addr;
if (flags & MAP_FIXED_NOREPLACE) {
@@ -2997,7 +2997,7 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla
flags |= VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
- if (offset_in_page(error))
+ if (IS_ERR_VALUE(error))
return error;
error = mlock_future_check(mm, mm->def_flags, len);
--
2.22.0
next reply other threads:[~2019-10-10 3:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 3:31 Gaowei Pu [this message]
2019-10-12 2:19 ` [PATCH] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area Andrew Morton
2019-10-12 9:41 ` gaowei Pu
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=20191010033117.22294-1-pugaowei@gmail.com \
--to=pugaowei@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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).