Commit df7c9d51 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] verify_area cleanup : misc remaining archs

The last remaining archs that have not already been converted from verify_area
to access_ok by the previous patches are all taken care of by this one.
Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c4c88808
...@@ -437,11 +437,10 @@ asmlinkage int ...@@ -437,11 +437,10 @@ asmlinkage int
osf_getdomainname(char __user *name, int namelen) osf_getdomainname(char __user *name, int namelen)
{ {
unsigned len; unsigned len;
int i, error; int i;
error = verify_area(VERIFY_WRITE, name, namelen); if (!access_ok(VERIFY_WRITE, name, namelen))
if (error) return -EFAULT;
goto out;
len = namelen; len = namelen;
if (namelen > 32) if (namelen > 32)
...@@ -454,8 +453,8 @@ osf_getdomainname(char __user *name, int namelen) ...@@ -454,8 +453,8 @@ osf_getdomainname(char __user *name, int namelen)
break; break;
} }
up_read(&uts_sem); up_read(&uts_sem);
out:
return error; return 0;
} }
asmlinkage long asmlinkage long
...@@ -996,7 +995,7 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, ...@@ -996,7 +995,7 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
if (tvp) { if (tvp) {
time_t sec, usec; time_t sec, usec;
if ((ret = verify_area(VERIFY_READ, tvp, sizeof(*tvp))) if ((ret = access_ok(VERIFY_READ, tvp, sizeof(*tvp)) ? 0 : -EFAULT)
|| (ret = __get_user(sec, &tvp->tv_sec)) || (ret = __get_user(sec, &tvp->tv_sec))
|| (ret = __get_user(usec, &tvp->tv_usec))) || (ret = __get_user(usec, &tvp->tv_usec)))
goto out_nofds; goto out_nofds;
......
...@@ -91,7 +91,7 @@ osf_sigaction(int sig, const struct osf_sigaction __user *act, ...@@ -91,7 +91,7 @@ osf_sigaction(int sig, const struct osf_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags)) __get_user(new_ka.sa.sa_flags, &act->sa_flags))
return -EFAULT; return -EFAULT;
...@@ -103,7 +103,7 @@ osf_sigaction(int sig, const struct osf_sigaction __user *act, ...@@ -103,7 +103,7 @@ osf_sigaction(int sig, const struct osf_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &oact->sa_flags)) __put_user(old_ka.sa.sa_flags, &oact->sa_flags))
return -EFAULT; return -EFAULT;
...@@ -298,7 +298,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs, ...@@ -298,7 +298,7 @@ do_sigreturn(struct sigcontext __user *sc, struct pt_regs *regs,
sigset_t set; sigset_t set;
/* Verify that it's a good sigcontext before using it */ /* Verify that it's a good sigcontext before using it */
if (verify_area(VERIFY_READ, sc, sizeof(*sc))) if (!access_ok(VERIFY_READ, sc, sizeof(*sc)))
goto give_sigsegv; goto give_sigsegv;
if (__get_user(set.sig[0], &sc->sc_mask)) if (__get_user(set.sig[0], &sc->sc_mask))
goto give_sigsegv; goto give_sigsegv;
...@@ -336,7 +336,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs, ...@@ -336,7 +336,7 @@ do_rt_sigreturn(struct rt_sigframe __user *frame, struct pt_regs *regs,
sigset_t set; sigset_t set;
/* Verify that it's a good ucontext_t before using it */ /* Verify that it's a good ucontext_t before using it */
if (verify_area(VERIFY_READ, &frame->uc, sizeof(frame->uc))) if (!access_ok(VERIFY_READ, &frame->uc, sizeof(frame->uc)))
goto give_sigsegv; goto give_sigsegv;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
goto give_sigsegv; goto give_sigsegv;
...@@ -446,7 +446,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -446,7 +446,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
oldsp = rdusp(); oldsp = rdusp();
frame = get_sigframe(ka, oldsp, sizeof(*frame)); frame = get_sigframe(ka, oldsp, sizeof(*frame));
if (verify_area(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv; goto give_sigsegv;
err |= setup_sigcontext(&frame->sc, regs, sw, set->sig[0], oldsp); err |= setup_sigcontext(&frame->sc, regs, sw, set->sig[0], oldsp);
...@@ -497,7 +497,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -497,7 +497,7 @@ setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
oldsp = rdusp(); oldsp = rdusp();
frame = get_sigframe(ka, oldsp, sizeof(*frame)); frame = get_sigframe(ka, oldsp, sizeof(*frame));
if (verify_area(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv; goto give_sigsegv;
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, info);
......
...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -317,7 +317,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs) ...@@ -317,7 +317,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
frame = (struct sigframe __user *)regs->ARM_sp; frame = (struct sigframe __user *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame))) if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
|| (_NSIG_WORDS > 1 || (_NSIG_WORDS > 1
...@@ -365,7 +365,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) ...@@ -365,7 +365,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
frame = (struct rt_sigframe __user *)regs->ARM_sp; frame = (struct rt_sigframe __user *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame))) if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
goto badframe; 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;
......
...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -186,7 +186,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs) ...@@ -186,7 +186,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
frame = (struct sigframe *)regs->ARM_sp; frame = (struct sigframe *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame))) if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
|| (_NSIG_WORDS > 1 || (_NSIG_WORDS > 1
...@@ -231,7 +231,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) ...@@ -231,7 +231,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
frame = (struct rt_sigframe *)regs->ARM_sp; frame = (struct rt_sigframe *)regs->ARM_sp;
if (verify_area(VERIFY_READ, frame, sizeof (*frame))) if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
goto badframe; 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;
......
...@@ -599,7 +599,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count, ...@@ -599,7 +599,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
int i, written, restart=1; int i, written, restart=1;
unsigned long p; unsigned long p;
if (verify_area(VERIFY_READ, buf, count)) if (!access_ok(VERIFY_READ, buf, count))
{ {
return -EFAULT; return -EFAULT;
} }
......
...@@ -355,7 +355,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count, ...@@ -355,7 +355,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
return -EFAULT; return -EFAULT;
} }
if (verify_area(VERIFY_READ, buf, count)) { if (!access_ok(VERIFY_READ, buf, count)) {
return -EFAULT; return -EFAULT;
} }
clk_mask = priv->clk_mask; clk_mask = priv->clk_mask;
......
...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -137,7 +137,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -137,7 +137,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -231,7 +231,7 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, ...@@ -231,7 +231,7 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
if (((long)frame) & 3) if (((long)frame) & 3)
goto badframe; goto badframe;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
|| (_NSIG_WORDS > 1 || (_NSIG_WORDS > 1
...@@ -273,7 +273,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, ...@@ -273,7 +273,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
if (((long)frame) & 3) if (((long)frame) & 3)
goto badframe; goto badframe;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -114,7 +114,7 @@ asmlinkage int sys_sigaction(int sig, ...@@ -114,7 +114,7 @@ asmlinkage int sys_sigaction(int sig,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -126,7 +126,7 @@ asmlinkage int sys_sigaction(int sig, ...@@ -126,7 +126,7 @@ asmlinkage int sys_sigaction(int sig,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -197,7 +197,7 @@ asmlinkage int sys_sigreturn(void) ...@@ -197,7 +197,7 @@ asmlinkage int sys_sigreturn(void)
sigset_t set; sigset_t set;
int gr8; int gr8;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.sc_oldmask)) if (__get_user(set.sig[0], &frame->sc.sc_oldmask))
goto badframe; goto badframe;
...@@ -228,7 +228,7 @@ asmlinkage int sys_rt_sigreturn(void) ...@@ -228,7 +228,7 @@ asmlinkage int sys_rt_sigreturn(void)
stack_t st; stack_t st;
int gr8; int gr8;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -113,7 +113,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -113,7 +113,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -222,7 +222,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...) ...@@ -222,7 +222,7 @@ asmlinkage int do_sigreturn(unsigned long __unused,...)
sigset_t set; sigset_t set;
int er0; int er0;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.sc_mask) || if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
(_NSIG_WORDS > 1 && (_NSIG_WORDS > 1 &&
...@@ -253,7 +253,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...) ...@@ -253,7 +253,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused,...)
sigset_t set; sigset_t set;
int er0; int er0;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -147,7 +147,7 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1, ...@@ -147,7 +147,7 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
stack_t st; stack_t st;
int result; int result;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -171,9 +171,9 @@ asmlinkage int sys_ipc(uint call, int first, int second, ...@@ -171,9 +171,9 @@ asmlinkage int sys_ipc(uint call, int first, int second,
case SHMAT: { case SHMAT: {
ulong raddr; ulong raddr;
if ((ret = verify_area(VERIFY_WRITE, (ulong __user *) third, if (!access_ok(VERIFY_WRITE, (ulong __user *) third,
sizeof(ulong)))) sizeof(ulong)))
return ret; return -EFAULT;
ret = do_shmat (first, (char __user *) ptr, second, &raddr); ret = do_shmat (first, (char __user *) ptr, second, &raddr);
if (ret) if (ret)
return ret; return ret;
......
...@@ -422,7 +422,7 @@ get_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset) ...@@ -422,7 +422,7 @@ get_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
if (ufdset) { if (ufdset) {
unsigned long odd; unsigned long odd;
if (verify_area(VERIFY_WRITE, ufdset, n*sizeof(u32))) if (!access_ok(VERIFY_WRITE, ufdset, n*sizeof(u32)))
return -EFAULT; return -EFAULT;
odd = n & 1UL; odd = n & 1UL;
......
...@@ -231,7 +231,7 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act, ...@@ -231,7 +231,7 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
if (act) { if (act) {
compat_old_sigset_t mask; compat_old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(sa_handler, &act->sa_handler) || __get_user(sa_handler, &act->sa_handler) ||
__get_user(sa_restorer, &act->sa_restorer)) __get_user(sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -247,7 +247,7 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act, ...@@ -247,7 +247,7 @@ sys32_sigaction(int sig, const struct old_sigaction32 __user *act,
if (!ret && oact) { if (!ret && oact) {
sa_handler = (unsigned long) old_ka.sa.sa_handler; sa_handler = (unsigned long) old_ka.sa.sa_handler;
sa_restorer = (unsigned long) old_ka.sa.sa_restorer; sa_restorer = (unsigned long) old_ka.sa.sa_restorer;
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(sa_handler, &oact->sa_handler) || __put_user(sa_handler, &oact->sa_handler) ||
__put_user(sa_restorer, &oact->sa_restorer)) __put_user(sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -416,7 +416,7 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs) ...@@ -416,7 +416,7 @@ asmlinkage long sys32_sigreturn(struct pt_regs *regs)
sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
...@@ -446,7 +446,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs) ...@@ -446,7 +446,7 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
int err; int err;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -116,7 +116,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -116,7 +116,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -128,7 +128,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -128,7 +128,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -214,7 +214,7 @@ asmlinkage long sys_sigreturn(struct pt_regs *regs) ...@@ -214,7 +214,7 @@ asmlinkage long sys_sigreturn(struct pt_regs *regs)
sigframe __user *frame = (sigframe __user *)regs->gprs[15]; sigframe __user *frame = (sigframe __user *)regs->gprs[15];
sigset_t set; sigset_t set;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
...@@ -240,7 +240,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) ...@@ -240,7 +240,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
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 (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; 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;
......
...@@ -99,7 +99,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -99,7 +99,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -111,7 +111,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -111,7 +111,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -238,7 +238,7 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5, ...@@ -238,7 +238,7 @@ asmlinkage int sys_sigreturn(unsigned long r4, unsigned long r5,
sigset_t set; sigset_t set;
int r0; int r0;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
...@@ -272,7 +272,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5, ...@@ -272,7 +272,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r4, unsigned long r5,
stack_t st; stack_t st;
int r0; int r0;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
......
...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -125,7 +125,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -137,7 +137,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -137,7 +137,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -293,7 +293,7 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3, ...@@ -293,7 +293,7 @@ asmlinkage int sys_sigreturn(unsigned long r2, unsigned long r3,
sigset_t set; sigset_t set;
long long ret; long long ret;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
...@@ -330,7 +330,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3, ...@@ -330,7 +330,7 @@ asmlinkage int sys_rt_sigreturn(unsigned long r2, unsigned long r3,
stack_t __user st; stack_t __user st;
long long ret; long long ret;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
......
...@@ -41,7 +41,7 @@ unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst ...@@ -41,7 +41,7 @@ unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst
* passed in an incorrect kernel address to one of these functions. * passed in an incorrect kernel address to one of these functions.
* *
* If you use these functions directly please don't forget the * If you use these functions directly please don't forget the
* verify_area(). * access_ok().
*/ */
static __inline__ static __inline__
......
...@@ -19,7 +19,7 @@ extern unsigned csum_partial(const unsigned char *buff, unsigned len, ...@@ -19,7 +19,7 @@ extern unsigned csum_partial(const unsigned char *buff, unsigned len,
* passed in an incorrect kernel address to one of these functions. * passed in an incorrect kernel address to one of these functions.
* *
* If you use these functions directly please don't forget the * If you use these functions directly please don't forget the
* verify_area(). * access_ok().
*/ */
static __inline__ static __inline__
......
...@@ -17,7 +17,7 @@ extern int modify_ldt(int func, void *ptr, unsigned long bytecount); ...@@ -17,7 +17,7 @@ extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
int sys_modify_ldt_tt(int func, void __user *ptr, unsigned long bytecount) int sys_modify_ldt_tt(int func, void __user *ptr, unsigned long bytecount)
{ {
if (verify_area(VERIFY_READ, ptr, bytecount)) if (!access_ok(VERIFY_READ, ptr, bytecount))
return -EFAULT; return -EFAULT;
return modify_ldt(func, ptr, bytecount); return modify_ldt(func, ptr, bytecount);
......
...@@ -217,8 +217,8 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig, ...@@ -217,8 +217,8 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
stack_top &= -8UL; stack_top &= -8UL;
frame = (struct sigframe *) stack_top - 1; frame = (struct sigframe *) stack_top - 1;
if(verify_area(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return(1); return 1;
restorer = (void *) frame->retcode; restorer = (void *) frame->retcode;
if(ka->sa.sa_flags & SA_RESTORER) if(ka->sa.sa_flags & SA_RESTORER)
...@@ -267,8 +267,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, ...@@ -267,8 +267,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
stack_top &= -8UL; stack_top &= -8UL;
frame = (struct rt_sigframe *) stack_top - 1; frame = (struct rt_sigframe *) stack_top - 1;
if(verify_area(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return(1); return 1;
restorer = (void *) frame->retcode; restorer = (void *) frame->retcode;
if(ka->sa.sa_flags & SA_RESTORER) if(ka->sa.sa_flags & SA_RESTORER)
......
...@@ -175,7 +175,7 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -175,7 +175,7 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -187,7 +187,7 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act, ...@@ -187,7 +187,7 @@ long sys_sigaction(int sig, const struct old_sigaction __user *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
......
...@@ -29,8 +29,8 @@ long sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount) ...@@ -29,8 +29,8 @@ long sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount)
/* XXX This should check VERIFY_WRITE depending on func, check this /* XXX This should check VERIFY_WRITE depending on func, check this
* in i386 as well. * in i386 as well.
*/ */
if(verify_area(VERIFY_READ, ptr, bytecount)) if (!access_ok(VERIFY_READ, ptr, bytecount))
return(-EFAULT); return -EFAULT;
return(modify_ldt(func, ptr, bytecount)); return(modify_ldt(func, ptr, bytecount));
} }
#endif #endif
......
...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -102,7 +102,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
if (act) { if (act) {
old_sigset_t mask; old_sigset_t mask;
if (verify_area(VERIFY_READ, act, sizeof(*act)) || if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) || __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction *act, ...@@ -114,7 +114,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) { if (!ret && oact) {
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) || __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
return -EFAULT; return -EFAULT;
...@@ -178,7 +178,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs) ...@@ -178,7 +178,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
sigset_t set; sigset_t set;
int rval; int rval;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__get_user(set.sig[0], &frame->sc.oldmask) if (__get_user(set.sig[0], &frame->sc.oldmask)
...@@ -209,7 +209,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) ...@@ -209,7 +209,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
stack_t st; stack_t st;
int rval; int rval;
if (verify_area(VERIFY_READ, frame, sizeof(*frame))) if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe; goto badframe;
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
......
...@@ -62,7 +62,7 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) ...@@ -62,7 +62,7 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
if (!ptr) if (!ptr)
break; break;
if ((ret = verify_area (VERIFY_READ, ptr, sizeof(long))) if ((ret = access_ok(VERIFY_READ, ptr, sizeof(long)) ? 0 : -EFAULT)
|| (ret = get_user(fourth.__pad, (void **)ptr))) || (ret = get_user(fourth.__pad, (void **)ptr)))
break; break;
ret = sys_semctl (first, second, third, fourth); ret = sys_semctl (first, second, third, fourth);
...@@ -78,7 +78,7 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) ...@@ -78,7 +78,7 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
if (!ptr) if (!ptr)
break; break;
if ((ret = verify_area (VERIFY_READ, ptr, sizeof(tmp))) if ((ret = access_ok(VERIFY_READ, ptr, sizeof(tmp)) ? 0 : -EFAULT)
|| (ret = copy_from_user(&tmp, || (ret = copy_from_user(&tmp,
(struct ipc_kludge *) ptr, (struct ipc_kludge *) ptr,
sizeof (tmp)))) sizeof (tmp))))
...@@ -104,8 +104,8 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) ...@@ -104,8 +104,8 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
default: { default: {
ulong raddr; ulong raddr;
if ((ret = verify_area(VERIFY_WRITE, (ulong*) third, if ((ret = access_ok(VERIFY_WRITE, (ulong*) third,
sizeof(ulong)))) sizeof(ulong)) ? 0 : -EFAULT))
break; break;
ret = do_shmat (first, (char *) ptr, second, &raddr); ret = do_shmat (first, (char *) ptr, second, &raddr);
if (ret) if (ret)
......
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