mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
get_unmapped_area handles MAP_FIXED in generic code
generic arch_get_unmapped_area() now handles MAP_FIXED. Now that all implementations have been fixed, change the toplevel get_unmapped_area() to call into arch or drivers for the MAP_FIXED case. Signed-off-by: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Russell King <[email protected]> Cc: David Howells <[email protected]> Cc: Andi Kleen <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Kyle McMartin <[email protected]> Cc: Grant Grundler <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: William Irwin <[email protected]> Cc: Adam Litke <[email protected]> Cc: David Gibson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
036e08568c
commit
06abdfb47e
1 changed files with 16 additions and 11 deletions
25
mm/mmap.c
25
mm/mmap.c
|
|
@ -1200,6 +1200,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
|
|||
if (len > TASK_SIZE)
|
||||
return -ENOMEM;
|
||||
|
||||
if (flags & MAP_FIXED)
|
||||
return addr;
|
||||
|
||||
if (addr) {
|
||||
addr = PAGE_ALIGN(addr);
|
||||
vma = find_vma(mm, addr);
|
||||
|
|
@ -1273,6 +1276,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
|
|||
if (len > TASK_SIZE)
|
||||
return -ENOMEM;
|
||||
|
||||
if (flags & MAP_FIXED)
|
||||
return addr;
|
||||
|
||||
/* requesting a specific address */
|
||||
if (addr) {
|
||||
addr = PAGE_ALIGN(addr);
|
||||
|
|
@ -1361,22 +1367,21 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
|
|||
unsigned long pgoff, unsigned long flags)
|
||||
{
|
||||
unsigned long ret;
|
||||
unsigned long (*get_area)(struct file *, unsigned long,
|
||||
unsigned long, unsigned long, unsigned long);
|
||||
|
||||
if (!(flags & MAP_FIXED)) {
|
||||
unsigned long (*get_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
|
||||
|
||||
get_area = current->mm->get_unmapped_area;
|
||||
if (file && file->f_op && file->f_op->get_unmapped_area)
|
||||
get_area = file->f_op->get_unmapped_area;
|
||||
addr = get_area(file, addr, len, pgoff, flags);
|
||||
if (IS_ERR_VALUE(addr))
|
||||
return addr;
|
||||
}
|
||||
get_area = current->mm->get_unmapped_area;
|
||||
if (file && file->f_op && file->f_op->get_unmapped_area)
|
||||
get_area = file->f_op->get_unmapped_area;
|
||||
addr = get_area(file, addr, len, pgoff, flags);
|
||||
if (IS_ERR_VALUE(addr))
|
||||
return addr;
|
||||
|
||||
if (addr > TASK_SIZE - len)
|
||||
return -ENOMEM;
|
||||
if (addr & ~PAGE_MASK)
|
||||
return -EINVAL;
|
||||
|
||||
if (file && is_file_hugepages(file)) {
|
||||
/*
|
||||
* Check if the given range is hugepage aligned, and
|
||||
|
|
|
|||
Loading…
Reference in a new issue