Commit d3815898 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] mmap: add missing compat_ptr conversion to both mmap compat syscalls

Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent a9df8e32
...@@ -616,44 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename, ...@@ -616,44 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename,
*/ */
struct mmap_arg_struct_emu31 { struct mmap_arg_struct_emu31 {
u32 addr; compat_ulong_t addr;
u32 len; compat_ulong_t len;
u32 prot; compat_ulong_t prot;
u32 flags; compat_ulong_t flags;
u32 fd; compat_ulong_t fd;
u32 offset; compat_ulong_t offset;
}; };
asmlinkage unsigned long asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
{ {
struct mmap_arg_struct_emu31 a; struct mmap_arg_struct_emu31 a;
int error = -EFAULT;
if (copy_from_user(&a, arg, sizeof(a))) if (copy_from_user(&a, arg, sizeof(a)))
goto out; return -EFAULT;
error = -EINVAL;
if (a.offset & ~PAGE_MASK) if (a.offset & ~PAGE_MASK)
goto out; return -EINVAL;
a.addr = (unsigned long) compat_ptr(a.addr);
error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
a.offset >> PAGE_SHIFT); a.offset >> PAGE_SHIFT);
out:
return error;
} }
asmlinkage long asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
{ {
struct mmap_arg_struct_emu31 a; struct mmap_arg_struct_emu31 a;
int error = -EFAULT;
if (copy_from_user(&a, arg, sizeof(a))) if (copy_from_user(&a, arg, sizeof(a)))
goto out; return -EFAULT;
error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); a.addr = (unsigned long) compat_ptr(a.addr);
out: return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
return error;
} }
asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment