public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix mmap2 syscall
@ 2009-04-20 21:48 SUGIOKA Toshinobu
  2009-04-20 22:14 ` Paul Mundt
  0 siblings, 1 reply; 2+ messages in thread
From: SUGIOKA Toshinobu @ 2009-04-20 21:48 UTC (permalink / raw)
  To: linux-sh

Hi,

Last argument of mmap2 system call is always (offset >> 12) in glibc regardless of the PAGE_SIZE,
but do_mmap_pgoff function requires 'pgoff' parameter which is shifted by real PAGE_SHIFT.
So, we should adjust this argument if page size is not equal to 4k byte.

Signed-off-by: Toshinobu Sugioka <sugioka@itonet.co.jp>

diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 58dfc02..15a56be 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -63,7 +63,9 @@ asmlinkage 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);
+	/* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
+	   we have. */
+	return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12));
 }
 
 /*


SUGIOKA Toshinobu


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-20 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 21:48 [PATCH] fix mmap2 syscall SUGIOKA Toshinobu
2009-04-20 22:14 ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox