diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2011-05-17 11:18:09 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-05-19 04:55:49 -0400 |
commit | 9c1e8a9138ff92a4ff816ea8a1884ad2461a993a (patch) | |
tree | 56ee6a37a0837a35c74ea378b4931e1667dd194e /arch/mips/kernel/syscall.c | |
parent | e650ce0f083ff9354a10ad66e6bf8c193e8a2755 (diff) |
MIPS: Cleanup arch_get_unmapped_area
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
Patchwork: https://patchwork.linux-mips.org/patch/2387/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/syscall.c')
-rw-r--r-- | arch/mips/kernel/syscall.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 58beabf50b3c..0c207e8ee601 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -79,20 +79,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
79 | { | 79 | { |
80 | struct vm_area_struct * vmm; | 80 | struct vm_area_struct * vmm; |
81 | int do_color_align; | 81 | int do_color_align; |
82 | unsigned long task_size; | ||
83 | 82 | ||
84 | #ifdef CONFIG_32BIT | 83 | if (len > TASK_SIZE) |
85 | task_size = TASK_SIZE; | ||
86 | #else /* Must be CONFIG_64BIT*/ | ||
87 | task_size = test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE; | ||
88 | #endif | ||
89 | |||
90 | if (len > task_size) | ||
91 | return -ENOMEM; | 84 | return -ENOMEM; |
92 | 85 | ||
93 | if (flags & MAP_FIXED) { | 86 | if (flags & MAP_FIXED) { |
94 | /* Even MAP_FIXED mappings must reside within task_size. */ | 87 | /* Even MAP_FIXED mappings must reside within TASK_SIZE. */ |
95 | if (task_size - len < addr) | 88 | if (TASK_SIZE - len < addr) |
96 | return -EINVAL; | 89 | return -EINVAL; |
97 | 90 | ||
98 | /* | 91 | /* |
@@ -114,7 +107,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
114 | else | 107 | else |
115 | addr = PAGE_ALIGN(addr); | 108 | addr = PAGE_ALIGN(addr); |
116 | vmm = find_vma(current->mm, addr); | 109 | vmm = find_vma(current->mm, addr); |
117 | if (task_size - len >= addr && | 110 | if (TASK_SIZE - len >= addr && |
118 | (!vmm || addr + len <= vmm->vm_start)) | 111 | (!vmm || addr + len <= vmm->vm_start)) |
119 | return addr; | 112 | return addr; |
120 | } | 113 | } |
@@ -126,7 +119,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
126 | 119 | ||
127 | for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { | 120 | for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { |
128 | /* At this point: (!vmm || addr < vmm->vm_end). */ | 121 | /* At this point: (!vmm || addr < vmm->vm_end). */ |
129 | if (task_size - len < addr) | 122 | if (TASK_SIZE - len < addr) |
130 | return -ENOMEM; | 123 | return -ENOMEM; |
131 | if (!vmm || addr + len <= vmm->vm_start) | 124 | if (!vmm || addr + len <= vmm->vm_start) |
132 | return addr; | 125 | return addr; |