Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[sfrench/cifs-2.6.git] / arch / arm64 / kernel / sys_compat.c
index 32653d156747e7d8c23ce34ec72ba17341be43a3..c832a5c24efc93870643909e7836b23cdced5723 100644 (file)
@@ -58,7 +58,7 @@ do_compat_cache_op(unsigned long start, unsigned long end, int flags)
        if (end < start || flags)
                return -EINVAL;
 
-       if (!access_ok(VERIFY_READ, (const void __user *)start, end - start))
+       if (!access_ok((const void __user *)start, end - start))
                return -EFAULT;
 
        return __do_compat_cache_op(start, end);
@@ -66,12 +66,11 @@ do_compat_cache_op(unsigned long start, unsigned long end, int flags)
 /*
  * Handle all unrecognised system calls.
  */
-long compat_arm_syscall(struct pt_regs *regs)
+long compat_arm_syscall(struct pt_regs *regs, int scno)
 {
-       unsigned int no = regs->regs[7];
        void __user *addr;
 
-       switch (no) {
+       switch (scno) {
        /*
         * Flush a region from virtual address 'r0' to virtual address 'r1'
         * _exclusive_.  There is no alignment requirement on either address;
@@ -102,12 +101,12 @@ long compat_arm_syscall(struct pt_regs *regs)
 
        default:
                /*
-                * Calls 9f00xx..9f07ff are defined to return -ENOSYS
+                * Calls 0xf0xxx..0xf07ff are defined to return -ENOSYS
                 * if not implemented, rather than raising SIGILL. This
                 * way the calling program can gracefully determine whether
                 * a feature is supported.
                 */
-               if ((no & 0xffff) <= 0x7ff)
+               if (scno < __ARM_NR_COMPAT_END)
                        return -ENOSYS;
                break;
        }
@@ -116,6 +115,6 @@ long compat_arm_syscall(struct pt_regs *regs)
                (compat_thumb_mode(regs) ? 2 : 4);
 
        arm64_notify_die("Oops - bad compat syscall(2)", regs,
-                        SIGILL, ILL_ILLTRP, addr, no);
+                        SIGILL, ILL_ILLTRP, addr, scno);
        return 0;
 }