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

s390/uaccess: remove pointless access_ok() checks

access_ok() always returns 'true' on s390. Therefore all calls
are quite pointless and can be removed.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f45655f6
...@@ -16,9 +16,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) ...@@ -16,9 +16,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
oparg = 1 << oparg; oparg = 1 << oparg;
if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
return -EFAULT;
pagefault_disable(); pagefault_disable();
ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval);
pagefault_enable(); pagefault_enable();
...@@ -40,9 +37,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) ...@@ -40,9 +37,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
u32 oldval, u32 newval) u32 oldval, u32 newval)
{ {
if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
return -EFAULT;
return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval); return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval);
} }
......
...@@ -252,9 +252,7 @@ static inline unsigned long __must_check ...@@ -252,9 +252,7 @@ static inline unsigned long __must_check
copy_to_user(void __user *to, const void *from, unsigned long n) copy_to_user(void __user *to, const void *from, unsigned long n)
{ {
might_fault(); might_fault();
if (access_ok(VERIFY_WRITE, to, n)) return __copy_to_user(to, from, n);
n = __copy_to_user(to, from, n);
return n;
} }
/** /**
...@@ -315,11 +313,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n) ...@@ -315,11 +313,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
copy_from_user_overflow(); copy_from_user_overflow();
return n; return n;
} }
if (access_ok(VERIFY_READ, from, n)) return __copy_from_user(to, from, n);
n = __copy_from_user(to, from, n);
else
memset(to, 0, n);
return n;
} }
static inline unsigned long __must_check static inline unsigned long __must_check
...@@ -332,9 +326,7 @@ static inline unsigned long __must_check ...@@ -332,9 +326,7 @@ static inline unsigned long __must_check
copy_in_user(void __user *to, const void __user *from, unsigned long n) copy_in_user(void __user *to, const void __user *from, unsigned long n)
{ {
might_fault(); might_fault();
if (__access_ok(from,n) && __access_ok(to,n)) return __copy_in_user(to, from, n);
n = __copy_in_user(to, from, n);
return n;
} }
/* /*
...@@ -343,11 +335,8 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n) ...@@ -343,11 +335,8 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
static inline long __must_check static inline long __must_check
strncpy_from_user(char *dst, const char __user *src, long count) strncpy_from_user(char *dst, const char __user *src, long count)
{ {
long res = -EFAULT;
might_fault(); might_fault();
if (access_ok(VERIFY_READ, src, 1)) return uaccess.strncpy_from_user(count, src, dst);
res = uaccess.strncpy_from_user(count, src, dst);
return res;
} }
static inline unsigned long static inline unsigned long
...@@ -387,9 +376,7 @@ static inline unsigned long __must_check ...@@ -387,9 +376,7 @@ static inline unsigned long __must_check
clear_user(void __user *to, unsigned long n) clear_user(void __user *to, unsigned long n)
{ {
might_fault(); might_fault();
if (access_ok(VERIFY_WRITE, to, n)) return uaccess.clear_user(n, to);
n = uaccess.clear_user(n, to);
return n;
} }
extern int copy_to_user_real(void __user *dest, void *src, size_t count); extern int copy_to_user_real(void __user *dest, void *src, size_t count);
......
...@@ -53,9 +53,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) ...@@ -53,9 +53,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
{ {
int err; int err;
if (!access_ok (VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
return -EFAULT;
/* If you change siginfo_t structure, please be sure /* If you change siginfo_t structure, please be sure
this code is fixed accordingly. this code is fixed accordingly.
It should never copy any pad contained in the structure It should never copy any pad contained in the structure
...@@ -110,9 +107,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) ...@@ -110,9 +107,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
int err; int err;
u32 tmp; u32 tmp;
if (!access_ok (VERIFY_READ, from, sizeof(compat_siginfo_t)))
return -EFAULT;
err = __get_user(to->si_signo, &from->si_signo); err = __get_user(to->si_signo, &from->si_signo);
err |= __get_user(to->si_errno, &from->si_errno); err |= __get_user(to->si_errno, &from->si_errno);
err |= __get_user(to->si_code, &from->si_code); err |= __get_user(to->si_code, &from->si_code);
...@@ -244,8 +238,6 @@ asmlinkage long sys32_sigreturn(void) ...@@ -244,8 +238,6 @@ asmlinkage long sys32_sigreturn(void)
sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
goto badframe; goto badframe;
set_current_blocked(&set); set_current_blocked(&set);
...@@ -265,8 +257,6 @@ asmlinkage long sys32_rt_sigreturn(void) ...@@ -265,8 +257,6 @@ asmlinkage long sys32_rt_sigreturn(void)
rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
goto badframe; goto badframe;
set_current_blocked(&set); set_current_blocked(&set);
...@@ -325,8 +315,6 @@ static int setup_frame32(int sig, struct k_sigaction *ka, ...@@ -325,8 +315,6 @@ static int setup_frame32(int sig, struct k_sigaction *ka,
sigset_t *set, struct pt_regs * regs) sigset_t *set, struct pt_regs * regs)
{ {
sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32)); sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(sigframe32));
if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
goto give_sigsegv;
if (frame == (void __user *) -1UL) if (frame == (void __user *) -1UL)
goto give_sigsegv; goto give_sigsegv;
...@@ -391,8 +379,6 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -391,8 +379,6 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
{ {
int err = 0; int err = 0;
rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32)); rt_sigframe32 __user *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
goto give_sigsegv;
if (frame == (void __user *) -1UL) if (frame == (void __user *) -1UL)
goto give_sigsegv; goto give_sigsegv;
......
...@@ -116,8 +116,6 @@ SYSCALL_DEFINE0(sigreturn) ...@@ -116,8 +116,6 @@ SYSCALL_DEFINE0(sigreturn)
sigframe __user *frame = (sigframe __user *)regs->gprs[15]; sigframe __user *frame = (sigframe __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
goto badframe; goto badframe;
set_current_blocked(&set); set_current_blocked(&set);
...@@ -135,8 +133,6 @@ SYSCALL_DEFINE0(rt_sigreturn) ...@@ -135,8 +133,6 @@ SYSCALL_DEFINE0(rt_sigreturn)
rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15]; rt_sigframe __user *frame = (rt_sigframe __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set)))
goto badframe; goto badframe;
set_current_blocked(&set); set_current_blocked(&set);
...@@ -195,8 +191,6 @@ static int setup_frame(int sig, struct k_sigaction *ka, ...@@ -195,8 +191,6 @@ static int setup_frame(int sig, struct k_sigaction *ka,
sigframe __user *frame; sigframe __user *frame;
frame = get_sigframe(ka, regs, sizeof(sigframe)); frame = get_sigframe(ka, regs, sizeof(sigframe));
if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe)))
goto give_sigsegv;
if (frame == (void __user *) -1UL) if (frame == (void __user *) -1UL)
goto give_sigsegv; goto give_sigsegv;
...@@ -264,8 +258,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -264,8 +258,6 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
rt_sigframe __user *frame; rt_sigframe __user *frame;
frame = get_sigframe(ka, regs, sizeof(rt_sigframe)); frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe)))
goto give_sigsegv;
if (frame == (void __user *) -1UL) if (frame == (void __user *) -1UL)
goto give_sigsegv; goto give_sigsegv;
......
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