diff options
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/osf_sys.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 9a3334ae282..62619f25132 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -178,25 +178,18 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len, | |||
178 | unsigned long, prot, unsigned long, flags, unsigned long, fd, | 178 | unsigned long, prot, unsigned long, flags, unsigned long, fd, |
179 | unsigned long, off) | 179 | unsigned long, off) |
180 | { | 180 | { |
181 | struct file *file = NULL; | 181 | unsigned long ret = -EINVAL; |
182 | unsigned long ret = -EBADF; | ||
183 | 182 | ||
184 | #if 0 | 183 | #if 0 |
185 | if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) | 184 | if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) |
186 | printk("%s: unimplemented OSF mmap flags %04lx\n", | 185 | printk("%s: unimplemented OSF mmap flags %04lx\n", |
187 | current->comm, flags); | 186 | current->comm, flags); |
188 | #endif | 187 | #endif |
189 | if (!(flags & MAP_ANONYMOUS)) { | 188 | if ((off + PAGE_ALIGN(len)) < off) |
190 | file = fget(fd); | 189 | goto out; |
191 | if (!file) | 190 | if (off & ~PAGE_MASK) |
192 | goto out; | 191 | goto out; |
193 | } | 192 | ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT); |
194 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
195 | down_write(¤t->mm->mmap_sem); | ||
196 | ret = do_mmap(file, addr, len, prot, flags, off); | ||
197 | up_write(¤t->mm->mmap_sem); | ||
198 | if (file) | ||
199 | fput(file); | ||
200 | out: | 193 | out: |
201 | return ret; | 194 | return ret; |
202 | } | 195 | } |