From 947df17cb1be4c7239280a77263c249fde1379ef Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 24 Feb 2006 21:20:29 -0800 Subject: [MIPS] sys_mmap2 offset argument should always be shifted 12, not PAGE_SHIFT. This patch adjusts the offset argument passed into sys_mmap2 to be always shifted 12, even when the native page size isn't 4K. This is what all existing userspace libraries expect. Signed-off-by: H. Peter Anvin Signed-off-by: Ralf Baechle --- --- arch/mips/kernel/syscall.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/mips/kernel/syscall.c') diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 55f2bc09529..2aeaa2fd4b3 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -162,7 +162,10 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { - return do_mmap2(addr, len, prot, flags, fd, pgoff); + if (pgoff & (~PAGE_MASK >> 12)) + return -EINVAL; + + return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12)); } save_static_function(sys_fork); -- cgit v1.2.3