aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/i387.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 367f39d35e9c..009183276bb7 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -341,7 +341,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
341 unsigned int pos, unsigned int count, 341 unsigned int pos, unsigned int count,
342 void *kbuf, void __user *ubuf) 342 void *kbuf, void __user *ubuf)
343{ 343{
344 struct xsave_struct *xsave = &target->thread.fpu.state->xsave; 344 struct xsave_struct *xsave;
345 int ret; 345 int ret;
346 346
347 if (!cpu_has_xsave) 347 if (!cpu_has_xsave)
@@ -351,6 +351,8 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
351 if (ret) 351 if (ret)
352 return ret; 352 return ret;
353 353
354 xsave = &target->thread.fpu.state->xsave;
355
354 /* 356 /*
355 * Copy the 48bytes defined by the software first into the xstate 357 * Copy the 48bytes defined by the software first into the xstate
356 * memory layout in the thread struct, so that we can copy the entire 358 * memory layout in the thread struct, so that we can copy the entire
@@ -369,7 +371,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
369 unsigned int pos, unsigned int count, 371 unsigned int pos, unsigned int count,
370 const void *kbuf, const void __user *ubuf) 372 const void *kbuf, const void __user *ubuf)
371{ 373{
372 struct xsave_struct *xsave = &target->thread.fpu.state->xsave; 374 struct xsave_struct *xsave;
373 int ret; 375 int ret;
374 376
375 if (!cpu_has_xsave) 377 if (!cpu_has_xsave)
@@ -379,6 +381,8 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,
379 if (ret) 381 if (ret)
380 return ret; 382 return ret;
381 383
384 xsave = &target->thread.fpu.state->xsave;
385
382 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1); 386 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1);
383 /* 387 /*
384 * mxcsr reserved bits must be masked to zero for security reasons. 388 * mxcsr reserved bits must be masked to zero for security reasons.