From: Andrew Morton <akpm@linux-foundation.org>
To: Gaowei Pu <pugaowei@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>, linux-mm@kvack.org
Subject: Re: [PATCH] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area
Date: Fri, 11 Oct 2019 19:19:06 -0700 [thread overview]
Message-ID: <20191011191906.9901e400a98f78a9b8652aeb@linux-foundation.org> (raw)
In-Reply-To: <20191010033117.22294-1-pugaowei@gmail.com>
On Thu, 10 Oct 2019 11:31:17 +0800 Gaowei Pu <pugaowei@gmail.com> wrote:
> get_unmapped_area already cover the offset_in_page() check and returned
> with error ptr. So replace offset_in_page() with IS_ERR_VALUE().
>
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -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);
./include/linux/err.h:22:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
^
./include/linux/compiler.h:78:42: note: in definition of macro unlikely
# define unlikely(x) __builtin_expect(!!(x), 0)
^
mm/mmap.c:3006:6: note: in expansion of macro IS_ERR_VALUE
if (IS_ERR_VALUE(error))
next prev parent reply other threads:[~2019-10-12 2:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 3:31 [PATCH] mm/mmap.c: use IS_ERR_VALUE to check return value of get_unmapped_area Gaowei Pu
2019-10-12 2:19 ` Andrew Morton [this message]
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=20191011191906.9901e400a98f78a9b8652aeb@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=pugaowei@gmail.com \
--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).