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

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens 2010-01-13 20:44:39 +01:00 committed by Martin Schwidefsky
parent a9df8e325d
commit d381589834

View File

@ -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)