nommu: add page alignment to mmap
Bob Liu authored
Currently on nommu arch mmap(),mremap() and munmap() doesn't do
page_align() which isn't consist with mmu arch and cause some issues.

First, some drivers' mmap() function depends on vma->vm_end - vma->start
is page aligned which is true on mmu arch but not on nommu.  eg: uvc
camera driver.

Second munmap() may return -EINVAL[split file] error in cases when end is
not page aligned(passed into from userspace) but vma->vm_end is aligned
dure to split or driver's mmap() ops.

Add page alignment to fix those issues.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Greg Ungerer <gerg@snapgear.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
f67d9b15
Name Last commit Last update
..
Kconfig mm: compaction: don't depend on HUGETLB_PAGE
Kconfig.debug mm: debug-pagealloc: fix kconfig dependency warning
Makefile bootmem: Separate out CONFIG_NO_BOOTMEM code into nobootmem.c
backing-dev.c Fix common misspellings
bootmem.c crash_dump: export is_kdump_kernel to modules, consolidate elfcorehdr_addr, setup_elfcorehdr and saved_max_pfn
bounce.c bounce: call flush_dcache_page() after bounce_copy_vec()
compaction.c mm: compaction: minimise the time IRQs are disabled while isolating pages for migration
debug-pagealloc.c generic debug pagealloc
dmapool.c mm/dmapool.c: use TASK_UNINTERRUPTIBLE in dma_pool_alloc()
fadvise.c readahead: introduce FMODE_RANDOM for POSIX_FADV_RANDOM
failslab.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
filemap.c readahead: trigger mmap sequential readahead on PG_readahead
filemap_xip.c mm: Convert i_mmap_lock to a mutex
fremap.c mm: Convert i_mmap_lock to a mutex
highmem.c mm,x86: fix kmap_atomic_push vs ioremap_32.c
huge_memory.c mm: thp: optimize memcg charge in khugepaged
hugetlb.c mm: Convert i_mmap_lock to a mutex
hwpoison-inject.c Fix common misspellings
init-mm.c mm: convert mm->cpu_vm_cpumask into cpumask_var_t
internal.h mm: nommu: sort mm->mmap list properly
kmemcheck.c kmemcheck: add hooks for the page allocator
kmemleak-test.c kmemleak: remove memset by using kzalloc
kmemleak.c kmemleak: Do not return a pointer to an object that kmemleak did not get
ksm.c oom: replace PF_OOM_ORIGIN with toggling oom_score_adj
maccess.c MN10300: Save frame pointer in thread_info struct rather than global var
madvise.c thp: khugepaged: make khugepaged aware about madvise
memblock.c mm/memblock: properly handle overlaps and fix error path
memcontrol.c memsw: remove noswapaccount kernel parameter
memory-failure.c vmscan: change shrinker API by passing shrink_control struct
memory.c mm: uninline large generic tlb.h functions
memory_hotplug.c mm: remove dependency on CONFIG_FLATMEM from online_page()
mempolicy.c mm: proc: move show_numa_map() to fs/proc/task_mmu.c
mempool.c mm: remove broken 'kzalloc' mempool
migrate.c mm: use refcounts for page_lock_anon_vma()
mincore.c thp: mincore transparent hugepage support
mlock.c VM: skip the stack guard page lookup in get_user_pages only for mlock
mm_init.c mm: mminit_loglevel cannot be __meminitdata anymore
mmap.c mm: convert anon_vma->lock to a mutex
mmu_context.c exit: fix oops in sync_mm_rss
mmu_notifier.c thp: mmu_notifier_test_young
mmzone.c mm: page allocator: adjust the per-cpu counter threshold when memory is low
mprotect.c thp: mprotect: transparent huge page support
mremap.c mm: Convert i_mmap_lock to a mutex
msync.c sanitize vfs_fsync calling conventions
nobootmem.c memblock/nobootmem: remove unneeded code from alloc_bootmem_node_high()
nommu.c nommu: add page alignment to mmap
oom_kill.c oom: replace PF_OOM_ORIGIN with toggling oom_score_adj
page-writeback.c Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block
page_alloc.c mm/page_alloc.c: prevent unending loop in __alloc_pages_slowpath()
page_cgroup.c memcg: allocate memory cgroup structures in local nodes
page_io.c
page_isolation.c
pagewalk.c
percpu-km.c
percpu-vm.c
percpu.c
pgtable-generic.c
prio_tree.c
quicklist.c
readahead.c
rmap.c
shmem.c
slab.c
slob.c
slub.c
sparse-vmemmap.c
sparse.c
swap.c
swap_state.c
swapfile.c
thrash.c
truncate.c
util.c
vmalloc.c
vmscan.c
vmstat.c