Commit 06aab5a3 authored by David Howells's avatar David Howells Committed by Linus Torvalds

NOMMU: Ignore mmap() address param as it is a hint

Ignore the address parameter given to NOMMU mmap() as it is a hint, rather
than giving an error if it's non-zero.  MAP_FIXED still gets an error.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 934831d0
...@@ -826,7 +826,7 @@ static int validate_mmap_request(struct file *file, ...@@ -826,7 +826,7 @@ static int validate_mmap_request(struct file *file,
int ret; int ret;
/* do the simple checks first */ /* do the simple checks first */
if (flags & MAP_FIXED || addr) { if (flags & MAP_FIXED) {
printk(KERN_DEBUG printk(KERN_DEBUG
"%d: Can't do fixed-address/overlay mmap of RAM\n", "%d: Can't do fixed-address/overlay mmap of RAM\n",
current->pid); current->pid);
...@@ -1182,9 +1182,6 @@ unsigned long do_mmap_pgoff(struct file *file, ...@@ -1182,9 +1182,6 @@ unsigned long do_mmap_pgoff(struct file *file,
kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff); kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);
if (!(flags & MAP_FIXED))
addr = round_hint_to_min(addr);
/* decide whether we should attempt the mapping, and if so what sort of /* decide whether we should attempt the mapping, and if so what sort of
* mapping */ * mapping */
ret = validate_mmap_request(file, addr, len, prot, flags, pgoff, ret = validate_mmap_request(file, addr, len, prot, flags, pgoff,
...@@ -1194,6 +1191,9 @@ unsigned long do_mmap_pgoff(struct file *file, ...@@ -1194,6 +1191,9 @@ unsigned long do_mmap_pgoff(struct file *file,
return ret; return ret;
} }
/* we ignore the address hint */
addr = 0;
/* we've determined that we can make the mapping, now translate what we /* we've determined that we can make the mapping, now translate what we
* now know into VMA flags */ * now know into VMA flags */
vm_flags = determine_vm_flags(file, prot, flags, capabilities); vm_flags = determine_vm_flags(file, prot, flags, capabilities);
......
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