aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/fpu/xstate.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-09-23 08:59:56 -0400
committerIngo Molnar <mingo@kernel.org>2017-09-24 07:04:33 -0400
commit7b9094c688f807c110a2dab6f6edc5876bfa7b0b (patch)
tree9f92afafe86afbf5e0190cc2b552dd313302ce06 /arch/x86/kernel/fpu/xstate.c
parent59dffa4edba1f15b2bfdbe608aca1efe664c674c (diff)
x86/fpu: Remove 'kbuf' parameter from the copy_user_to_xstate() API
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-14-mingo@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/fpu/xstate.c')
-rw-r--r--arch/x86/kernel/fpu/xstate.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 71cc8d367fdd..b1f3e4dae2e3 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1142,8 +1142,7 @@ int copy_kernel_to_xstate(const void *kbuf, struct xregs_state *xsave)
1142 * there we check the CPU has XSAVES and a whole standard-sized buffer 1142 * there we check the CPU has XSAVES and a whole standard-sized buffer
1143 * exists. 1143 * exists.
1144 */ 1144 */
1145int copy_user_to_xstate(const void *kbuf, const void __user *ubuf, 1145int copy_user_to_xstate(const void __user *ubuf, struct xregs_state *xsave)
1146 struct xregs_state *xsave)
1147{ 1146{
1148 unsigned int offset, size; 1147 unsigned int offset, size;
1149 int i; 1148 int i;
@@ -1153,12 +1152,8 @@ int copy_user_to_xstate(const void *kbuf, const void __user *ubuf,
1153 offset = offsetof(struct xregs_state, header); 1152 offset = offsetof(struct xregs_state, header);
1154 size = sizeof(xfeatures); 1153 size = sizeof(xfeatures);
1155 1154
1156 if (kbuf) { 1155 if (__copy_from_user(&xfeatures, ubuf + offset, size))
1157 memcpy(&xfeatures, kbuf + offset, size); 1156 return -EFAULT;
1158 } else {
1159 if (__copy_from_user(&xfeatures, ubuf + offset, size))
1160 return -EFAULT;
1161 }
1162 1157
1163 /* 1158 /*
1164 * Reject if the user sets any disabled or supervisor features: 1159 * Reject if the user sets any disabled or supervisor features:
@@ -1177,12 +1172,8 @@ int copy_user_to_xstate(const void *kbuf, const void __user *ubuf,
1177 offset = xstate_offsets[i]; 1172 offset = xstate_offsets[i];
1178 size = xstate_sizes[i]; 1173 size = xstate_sizes[i];
1179 1174
1180 if (kbuf) { 1175 if (__copy_from_user(dst, ubuf + offset, size))
1181 memcpy(dst, kbuf + offset, size); 1176 return -EFAULT;
1182 } else {
1183 if (__copy_from_user(dst, ubuf + offset, size))
1184 return -EFAULT;
1185 }
1186 } 1177 }
1187 } 1178 }
1188 1179