All of lore.kernel.org
 help / color / mirror / Atom feed
From: SUGIOKA Toshinobu <sugioka@itonet.co.jp>
To: linux-sh@vger.kernel.org
Subject: [PATCH] fix mmap2 syscall
Date: Mon, 20 Apr 2009 21:48:43 +0000	[thread overview]
Message-ID: <4.2.0.58.J.20090421052216.0362b680@router.itonet.co.jp> (raw)

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


             reply	other threads:[~2009-04-20 21:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 21:48 SUGIOKA Toshinobu [this message]
2009-04-20 22:14 ` [PATCH] fix mmap2 syscall Paul Mundt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.2.0.58.J.20090421052216.0362b680@router.itonet.co.jp \
    --to=sugioka@itonet.co.jp \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.