aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/sys_sparc_64.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-11-30 17:37:04 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-11 06:44:29 -0500
commitf8b7256096a20436f6d0926747e3ac3d64c81d24 (patch)
tree18bcabd1de263bd2d0f8d6b763bde8b037716c5c /arch/sparc/kernel/sys_sparc_64.c
parent0067bd8a55862ac9dd212bd1c4f6f5bff1ca1301 (diff)
Unify sys_mmap*
New helper - sys_mmap_pgoff(); switch syscalls to using it. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/sparc/kernel/sys_sparc_64.c')
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index d498b32c75f..8f9cd58497d 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -572,23 +572,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
572 unsigned long, prot, unsigned long, flags, unsigned long, fd, 572 unsigned long, prot, unsigned long, flags, unsigned long, fd,
573 unsigned long, off) 573 unsigned long, off)
574{ 574{
575 struct file * file = NULL; 575 unsigned long retval = -EINVAL;
576 unsigned long retval = -EBADF;
577 576
578 if (!(flags & MAP_ANONYMOUS)) { 577 if ((off + PAGE_ALIGN(len)) < off)
579 file = fget(fd); 578 goto out;
580 if (!file) 579 if (off & ~PAGE_MASK)
581 goto out; 580 goto out;
582 } 581 retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
583 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
584 len = PAGE_ALIGN(len);
585
586 down_write(&current->mm->mmap_sem);
587 retval = do_mmap(file, addr, len, prot, flags, off);
588 up_write(&current->mm->mmap_sem);
589
590 if (file)
591 fput(file);
592out: 582out:
593 return retval; 583 return retval;
594} 584}