Commit 9c1e8a91 authored by Ralf Baechle's avatar Ralf Baechle
parent e650ce0f
...@@ -79,20 +79,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -79,20 +79,13 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
{ {
struct vm_area_struct * vmm; struct vm_area_struct * vmm;
int do_color_align; int do_color_align;
unsigned long task_size;
#ifdef CONFIG_32BIT if (len > TASK_SIZE)
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)
return -ENOMEM; return -ENOMEM;
if (flags & MAP_FIXED) { if (flags & MAP_FIXED) {
/* Even MAP_FIXED mappings must reside within task_size. */ /* Even MAP_FIXED mappings must reside within TASK_SIZE. */
if (task_size - len < addr) if (TASK_SIZE - len < addr)
return -EINVAL; return -EINVAL;
/* /*
...@@ -114,7 +107,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -114,7 +107,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
else else
addr = PAGE_ALIGN(addr); addr = PAGE_ALIGN(addr);
vmm = find_vma(current->mm, addr); vmm = find_vma(current->mm, addr);
if (task_size - len >= addr && if (TASK_SIZE - len >= addr &&
(!vmm || addr + len <= vmm->vm_start)) (!vmm || addr + len <= vmm->vm_start))
return addr; return addr;
} }
...@@ -126,7 +119,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, ...@@ -126,7 +119,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
/* At this point: (!vmm || addr < vmm->vm_end). */ /* At this point: (!vmm || addr < vmm->vm_end). */
if (task_size - len < addr) if (TASK_SIZE - len < addr)
return -ENOMEM; return -ENOMEM;
if (!vmm || addr + len <= vmm->vm_start) if (!vmm || addr + len <= vmm->vm_start)
return addr; return addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment