Skip to content

Commit 9c1e8a9

Browse files
committed
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>
1 parent e650ce0 commit 9c1e8a9

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

‎arch/mips/kernel/syscall.c‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
7979
{
8080
struct vm_area_struct * vmm;
8181
int do_color_align;
82-
unsigned long task_size;
8382

84-
#ifdef CONFIG_32BIT
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)
83+
if (len > TASK_SIZE)
9184
return -ENOMEM;
9285

9386
if (flags & MAP_FIXED) {
94-
/* Even MAP_FIXED mappings must reside within task_size. */
95-
if (task_size - len < addr)
87+
/* Even MAP_FIXED mappings must reside within TASK_SIZE. */
88+
if (TASK_SIZE - len < addr)
9689
return -EINVAL;
9790

9891
/*
@@ -114,7 +107,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
114107
else
115108
addr = PAGE_ALIGN(addr);
116109
vmm = find_vma(current->mm, addr);
117-
if (task_size - len >= addr &&
110+
if (TASK_SIZE - len >= addr &&
118111
(!vmm || addr + len <= vmm->vm_start))
119112
return addr;
120113
}
@@ -126,7 +119,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
126119

127120
for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
128121
/* At this point: (!vmm || addr < vmm->vm_end). */
129-
if (task_size - len < addr)
122+
if (TASK_SIZE - len < addr)
130123
return -ENOMEM;
131124
if (!vmm || addr + len <= vmm->vm_start)
132125
return addr;

0 commit comments

Comments
 (0)