x86/fpu: Remove 'ubuf' parameter from the copy_kernel_to_xstate() API
authorIngo Molnar <mingo@kernel.org>
Sat, 23 Sep 2017 12:59:55 +0000 (14:59 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 24 Sep 2017 11:04:33 +0000 (13:04 +0200)
No change in functionality.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Eric Biggers <ebiggers3@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Link: http://lkml.kernel.org/r/20170923130016.21448-13-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/fpu/xstate.h
arch/x86/kernel/fpu/regset.c
arch/x86/kernel/fpu/xstate.c

index 79af79dbcab6770eea8e8831843d57244e913357..f10889bc0c88fdf3531cc6e05bf1ffff5c195df1 100644 (file)
@@ -50,6 +50,6 @@ const void *get_xsave_field_ptr(int xstate_field);
 int using_compacted_format(void);
 int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int offset, unsigned int size);
 int copy_xstate_to_user(void __user *ubuf, struct xregs_state *xsave, unsigned int offset, unsigned int size);
-int copy_kernel_to_xstate(const void *kbuf, const void __user *ubuf, struct xregs_state *xsave);
+int copy_kernel_to_xstate(const void *kbuf, struct xregs_state *xsave);
 int copy_user_to_xstate(const void *kbuf, const void __user *ubuf, struct xregs_state *xsave);
 #endif
index cb45dd81d6170c0225deba4b9d833098632e83a5..785302c75f386dfa33691681c5dc4674fa76a4e4 100644 (file)
@@ -136,7 +136,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
 
        if (boot_cpu_has(X86_FEATURE_XSAVES)) {
                if (kbuf)
-                       ret = copy_kernel_to_xstate(kbuf, ubuf, xsave);
+                       ret = copy_kernel_to_xstate(kbuf, xsave);
                else
                        ret = copy_user_to_xstate(kbuf, ubuf, xsave);
        } else {
index 1ad25d1b805612289d8fdc16016d91949104fa44..71cc8d367fdd1b009d85a38b6395f8ab95d32cd9 100644 (file)
@@ -1089,8 +1089,7 @@ int copy_xstate_to_user(void __user *ubuf, struct xregs_state *xsave, unsigned i
  * there we check the CPU has XSAVES and a whole standard-sized buffer
  * exists.
  */
-int copy_kernel_to_xstate(const void *kbuf, const void __user *ubuf,
-                    struct xregs_state *xsave)
+int copy_kernel_to_xstate(const void *kbuf, struct xregs_state *xsave)
 {
        unsigned int offset, size;
        int i;
@@ -1100,12 +1099,7 @@ int copy_kernel_to_xstate(const void *kbuf, const void __user *ubuf,
        offset = offsetof(struct xregs_state, header);
        size = sizeof(xfeatures);
 
-       if (kbuf) {
-               memcpy(&xfeatures, kbuf + offset, size);
-       } else {
-               if (__copy_from_user(&xfeatures, ubuf + offset, size))
-                       return -EFAULT;
-       }
+       memcpy(&xfeatures, kbuf + offset, size);
 
        /*
         * Reject if the user sets any disabled or supervisor features:
@@ -1124,12 +1118,7 @@ int copy_kernel_to_xstate(const void *kbuf, const void __user *ubuf,
                        offset = xstate_offsets[i];
                        size = xstate_sizes[i];
 
-                       if (kbuf) {
-                               memcpy(dst, kbuf + offset, size);
-                       } else {
-                               if (__copy_from_user(dst, ubuf + offset, size))
-                                       return -EFAULT;
-                       }
+                       memcpy(dst, kbuf + offset, size);
                }
        }