aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/syscall.c17
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;