Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 54238
b: refs/heads/master
c: 06abdfb
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed May 7, 2007
1 parent b8bede1 commit 212fe03
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 036e08568cbee4b16e14551e9f004c3d490d6271
refs/heads/master: 06abdfb47ee745a4d79721de24260815ec6bca2b
27 changes: 16 additions & 11 deletions trunk/mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

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;
}
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;

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
Expand Down

0 comments on commit 212fe03

Please sign in to comment.