Commit 06aab5a3084e1d825384fa353e6df4c7949c8683
Committed by
Linus Torvalds
1 parent
934831d060
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: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
mm/nommu.c
... | ... | @@ -826,7 +826,7 @@ |
826 | 826 | int ret; |
827 | 827 | |
828 | 828 | /* do the simple checks first */ |
829 | - if (flags & MAP_FIXED || addr) { | |
829 | + if (flags & MAP_FIXED) { | |
830 | 830 | printk(KERN_DEBUG |
831 | 831 | "%d: Can't do fixed-address/overlay mmap of RAM\n", |
832 | 832 | current->pid); |
... | ... | @@ -1182,9 +1182,6 @@ |
1182 | 1182 | |
1183 | 1183 | kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff); |
1184 | 1184 | |
1185 | - if (!(flags & MAP_FIXED)) | |
1186 | - addr = round_hint_to_min(addr); | |
1187 | - | |
1188 | 1185 | /* decide whether we should attempt the mapping, and if so what sort of |
1189 | 1186 | * mapping */ |
1190 | 1187 | ret = validate_mmap_request(file, addr, len, prot, flags, pgoff, |
... | ... | @@ -1193,6 +1190,9 @@ |
1193 | 1190 | kleave(" = %d [val]", ret); |
1194 | 1191 | return ret; |
1195 | 1192 | } |
1193 | + | |
1194 | + /* we ignore the address hint */ | |
1195 | + addr = 0; | |
1196 | 1196 | |
1197 | 1197 | /* we've determined that we can make the mapping, now translate what we |
1198 | 1198 | * now know into VMA flags */ |