From patchwork Mon Apr 20 21:48:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SUGIOKA Toshinobu X-Patchwork-Id: 19097 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3KMpvlV025665 for ; Mon, 20 Apr 2009 22:51:57 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756211AbZDTWv4 (ORCPT ); Mon, 20 Apr 2009 18:51:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756289AbZDTWv4 (ORCPT ); Mon, 20 Apr 2009 18:51:56 -0400 Received: from ns.itonet.jp ([61.199.205.34]:47997 "EHLO ns.itonet.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756211AbZDTWvz (ORCPT ); Mon, 20 Apr 2009 18:51:55 -0400 X-Greylist: delayed 3789 seconds by postgrey-1.27 at vger.kernel.org; Mon, 20 Apr 2009 18:51:54 EDT Received: from xpsugioka (xpsugioka.itonet.co.jp [192.168.0.200]) by ns.itonet.jp (8.11.6/8.11.6) with ESMTP id n3KLmhp15339; Tue, 21 Apr 2009 06:48:43 +0900 Message-Id: <4.2.0.58.J.20090421052216.0362b680@router.itonet.co.jp> X-Sender: sugioka@gate.itonet.co.jp X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58.J Date: Tue, 21 Apr 2009 06:48:43 +0900 To: Paul Mundt From: SUGIOKA Toshinobu Subject: [PATCH] fix mmap2 syscall Cc: linux-sh@vger.kernel.org Mime-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 Toshinobu --- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)); } /*