From: Ralf Baechle <ralf@linux-mips.org>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: Jian Peng <jipeng@broadcom.com>,
David Daney <ddaney@caviumnetworks.com>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Subject: [PATCH] MIPS: Cleanup arch_get_unmapped_area
Date: Tue, 17 May 2011 16:18:09 +0100 [thread overview]
Message-ID: <20110517151809.GA7932@linux-mips.org> (raw)
In-Reply-To: <BANLkTikq04wuK=bz+Lieavmm3oDtoYWKxg@mail.gmail.com>
On Mon, May 16, 2011 at 06:27:17PM -0700, Kevin Cernekee wrote:
> >> +#ifdef CONFIG_32BIT
> >> + task_size = TASK_SIZE;
> >> +#else /* Must be CONFIG_64BIT*/
> >> + task_size = test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 :
> >> TASK_SIZE;
> >> +#endif
>
> Can the "#else" clause and "task_size" local variable be eliminated?
> TASK_SIZE now performs this check automatically (although that wasn't
> always the case).
As noticed by Kevin Cernekee <cernekee@gmail.com> in
http://www.linux-mips.org/cgi-bin/extract-mesg.cgi?a=linux-mips&m=2011-05&i=BANLkTikq04wuK%3Dbz%2BLieavmm3oDtoYWKxg%40mail.gmail.com
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/syscall.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
Index: linux-queue/arch/mips/kernel/syscall.c
===================================================================
--- linux-queue.orig/arch/mips/kernel/syscall.c
+++ linux-queue/arch/mips/kernel/syscall.c
@@ -79,20 +79,13 @@ unsigned long arch_get_unmapped_area(str
{
struct vm_area_struct * vmm;
int do_color_align;
- unsigned long task_size;
-#ifdef CONFIG_32BIT
- task_size = TASK_SIZE;
-#else /* Must be CONFIG_64BIT*/
- task_size = test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE;
-#endif
-
- if (len > task_size)
+ if (len > TASK_SIZE)
return -ENOMEM;
if (flags & MAP_FIXED) {
- /* Even MAP_FIXED mappings must reside within task_size. */
- if (task_size - len < addr)
+ /* Even MAP_FIXED mappings must reside within TASK_SIZE. */
+ if (TASK_SIZE - len < addr)
return -EINVAL;
/*
@@ -114,7 +107,7 @@ unsigned long arch_get_unmapped_area(str
else
addr = PAGE_ALIGN(addr);
vmm = find_vma(current->mm, addr);
- if (task_size - len >= addr &&
+ if (TASK_SIZE - len >= addr &&
(!vmm || addr + len <= vmm->vm_start))
return addr;
}
@@ -126,7 +119,7 @@ unsigned long arch_get_unmapped_area(str
for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
/* At this point: (!vmm || addr < vmm->vm_end). */
- if (task_size - len < addr)
+ if (TASK_SIZE - len < addr)
return -ENOMEM;
if (!vmm || addr + len <= vmm->vm_start)
return addr;
next prev parent reply other threads:[~2011-05-17 15:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-16 21:09 patch to support topdown mmap allocation in MIPS Jian Peng
2011-05-16 23:37 ` Jian Peng
2011-05-17 0:12 ` David Daney
2011-05-17 1:06 ` Jian Peng
2011-05-17 16:49 ` David Daney
2011-05-17 19:37 ` Jian Peng
2011-05-25 17:47 ` Jian Peng
2011-05-25 17:58 ` David Daney
2011-05-25 18:06 ` Jian Peng
2011-06-13 23:43 ` Jian Peng
2011-06-14 0:21 ` Jian Peng
2011-11-09 17:45 ` Ralf Baechle
2011-05-17 1:27 ` Kevin Cernekee
2011-05-17 4:04 ` Jian Peng
2011-05-17 15:18 ` Ralf Baechle [this message]
2011-05-17 16:52 ` Ralf Baechle
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=20110517151809.GA7932@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=cernekee@gmail.com \
--cc=ddaney@caviumnetworks.com \
--cc=jipeng@broadcom.com \
--cc=linux-mips@linux-mips.org \
/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