aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/sys_parisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/kernel/sys_parisc.c')
-rw-r--r--arch/parisc/kernel/sys_parisc.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 71b31957c8f1..9147391afb03 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -110,37 +110,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
110 return addr; 110 return addr;
111} 111}
112 112
113static unsigned long do_mmap2(unsigned long addr, unsigned long len,
114 unsigned long prot, unsigned long flags, unsigned long fd,
115 unsigned long pgoff)
116{
117 struct file * file = NULL;
118 unsigned long error = -EBADF;
119 if (!(flags & MAP_ANONYMOUS)) {
120 file = fget(fd);
121 if (!file)
122 goto out;
123 }
124
125 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
126
127 down_write(&current->mm->mmap_sem);
128 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
129 up_write(&current->mm->mmap_sem);
130
131 if (file != NULL)
132 fput(file);
133out:
134 return error;
135}
136
137asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 113asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
138 unsigned long prot, unsigned long flags, unsigned long fd, 114 unsigned long prot, unsigned long flags, unsigned long fd,
139 unsigned long pgoff) 115 unsigned long pgoff)
140{ 116{
141 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 117 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
142 we have. */ 118 we have. */
143 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); 119 return sys_mmap_pgoff(addr, len, prot, flags, fd,
120 pgoff >> (PAGE_SHIFT - 12));
144} 121}
145 122
146asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 123asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
@@ -148,7 +125,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
148 unsigned long offset) 125 unsigned long offset)
149{ 126{
150 if (!(offset & ~PAGE_MASK)) { 127 if (!(offset & ~PAGE_MASK)) {
151 return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 128 return sys_mmap_pgoff(addr, len, prot, flags, fd,
129 offset >> PAGE_SHIFT);
152 } else { 130 } else {
153 return -EINVAL; 131 return -EINVAL;
154 } 132 }