diff options
Diffstat (limited to 'arch/frv/kernel/sys_frv.c')
-rw-r--r-- | arch/frv/kernel/sys_frv.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c index 49b2cf2c38f3..baadc97f8627 100644 --- a/arch/frv/kernel/sys_frv.c +++ b/arch/frv/kernel/sys_frv.c | |||
@@ -35,22 +35,21 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | |||
35 | int error = -EBADF; | 35 | int error = -EBADF; |
36 | struct file * file = NULL; | 36 | struct file * file = NULL; |
37 | 37 | ||
38 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
39 | if (!(flags & MAP_ANONYMOUS)) { | ||
40 | file = fget(fd); | ||
41 | if (!file) | ||
42 | goto out; | ||
43 | } | ||
44 | |||
45 | /* As with sparc32, make sure the shift for mmap2 is constant | 38 | /* As with sparc32, make sure the shift for mmap2 is constant |
46 | (12), no matter what PAGE_SIZE we have.... */ | 39 | (12), no matter what PAGE_SIZE we have.... */ |
47 | 40 | ||
48 | /* But unlike sparc32, don't just silently break if we're | 41 | /* But unlike sparc32, don't just silently break if we're |
49 | trying to map something we can't */ | 42 | trying to map something we can't */ |
50 | if (pgoff & ((1<<(PAGE_SHIFT-12))-1)) | 43 | if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) |
51 | return -EINVAL; | 44 | return -EINVAL; |
45 | pgoff >>= PAGE_SHIFT - 12; | ||
52 | 46 | ||
53 | pgoff >>= (PAGE_SHIFT - 12); | 47 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
48 | if (!(flags & MAP_ANONYMOUS)) { | ||
49 | file = fget(fd); | ||
50 | if (!file) | ||
51 | goto out; | ||
52 | } | ||
54 | 53 | ||
55 | down_write(¤t->mm->mmap_sem); | 54 | down_write(¤t->mm->mmap_sem); |
56 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 55 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |