aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/sys_sparc_64.c
diff options
context:
space:
mode:
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 d498b32c75f6..8f9cd58497de 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}