return task_thread_info(current)->thr_ptr;
 }
 
-SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
+SYSCALL_DEFINE3(arc_usr_cmpxchg, int __user *, uaddr, int, expected, int, new)
 {
        struct pt_regs *regs = current_pt_regs();
        u32 uval;
 
                 destreg, EXTRACT_REG_NUM(instr, RT2_OFFSET), data);
 
        /* Check access in reasonable access range for both SWP and SWPB */
-       if (!access_ok((address & ~3), 4)) {
+       if (!access_ok((void __user *)(address & ~3), 4)) {
                pr_debug("SWP{B} emulation: access to %p not allowed!\n",
                         (void *)address);
                res = -EFAULT;
 
        if (end < start || flags)
                return -EINVAL;
 
-       if (!access_ok(start, end - start))
+       if (!access_ok((void __user *)start, end - start))
                return -EFAULT;
 
        return __do_cache_op(start, end);
 
 {
        struct stackframe buftail;
        unsigned long lr = 0;
-       unsigned long *user_frame_tail = (unsigned long *)fp;
+       unsigned long __user *user_frame_tail = (unsigned long __user *)fp;
 
        /* Check accessibility of one struct frame_tail beyond */
        if (!access_ok(user_frame_tail, sizeof(buftail)))
 
 static int
 setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs)
 {
-       struct rt_sigframe *frame;
+       struct rt_sigframe __user *frame;
        int err = 0;
 
        frame = get_sigframe(ksig, regs, sizeof(*frame));
 
 
 static inline int rt_restore_ucontext(struct pt_regs *regs,
                                        struct switch_stack *sw,
-                                       struct ucontext *uc, int *pr2)
+                                       struct ucontext __user *uc, int *pr2)
 {
        int temp;
-       unsigned long *gregs = uc->uc_mcontext.gregs;
+       unsigned long __user *gregs = uc->uc_mcontext.gregs;
        int err;
 
        /* Always make any pending restarted system calls return -EINTR */
 {
        struct pt_regs *regs = (struct pt_regs *)(sw + 1);
        /* Verify, can we follow the stack back */
-       struct rt_sigframe *frame = (struct rt_sigframe *) regs->sp;
+       struct rt_sigframe __user *frame;
        sigset_t set;
        int rval;
 
+       frame = (struct rt_sigframe __user *) regs->sp;
        if (!access_ok(frame, sizeof(*frame)))
                goto badframe;
 
        return 0;
 }
 
-static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
+static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
 {
        struct switch_stack *sw = (struct switch_stack *)regs - 1;
-       unsigned long *gregs = uc->uc_mcontext.gregs;
+       unsigned long __user *gregs = uc->uc_mcontext.gregs;
        int err = 0;
 
        err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
        return err;
 }
 
-static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
-                                size_t frame_size)
+static inline void __user *get_sigframe(struct ksignal *ksig,
+                                       struct pt_regs *regs,
+                                       size_t frame_size)
 {
        unsigned long usp;
 
        usp = sigsp(usp, ksig);
 
        /* Verify, is it 32 or 64 bit aligned */
-       return (void *)((usp - frame_size) & -8UL);
+       return (void __user *)((usp - frame_size) & -8UL);
 }
 
 static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
                          struct pt_regs *regs)
 {
-       struct rt_sigframe *frame;
+       struct rt_sigframe __user *frame;
        int err = 0;
 
        frame = get_sigframe(ksig, regs, sizeof(*frame));
 
 {
        if (!user_mode(regs))
                return 1;
-       if (__access_ok(ea, nb))
+       if (access_ok((void __user *)ea, nb))
                return 1;
-       if (__access_ok(ea, 1))
+       if (access_ok((void __user *)ea, 1))
                /* Access overlaps the end of the user region */
                regs->dar = TASK_SIZE_MAX - 1;
        else
 
 {
        struct stackframe buftail;
        unsigned long ra = 0;
-       unsigned long *user_frame_tail =
-                       (unsigned long *)(fp - sizeof(struct stackframe));
+       unsigned long __user *user_frame_tail =
+               (unsigned long __user *)(fp - sizeof(struct stackframe));
 
        /* Check accessibility of one struct frame_tail beyond */
        if (!access_ok(user_frame_tail, sizeof(buftail)))
 
  */
 static inline bool invalid_frame_pointer(void __user *fp, int fplen)
 {
-       if ((((unsigned long) fp) & 15) || !__access_ok((unsigned long)fp, fplen))
+       if ((((unsigned long) fp) & 15) || !access_ok(fp, fplen))
                return true;
 
        return false;
 
                return false;
 
        /* should be at least readable kernel address */
-       if (access_ok(ptr, 1) ||
-           access_ok(ptr + size - 1, 1) ||
+       if (access_ok((void __user *)ptr, 1) ||
+           access_ok((void __user *)ptr + size - 1, 1) ||
            get_kernel_nofault(buf, ptr) ||
            get_kernel_nofault(buf, ptr + size - 1)) {
                pr_err("invalid kernel ptr: %#lx\n", addr);