aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/x86/kernel/fpu/signal.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-10-13 16:55:48 +0200
committerBorislav Petkov <bp@suse.de>2021-10-21 14:02:25 +0200
commitbe31dfdfd75b172af3ddcfa7511cdc3bb7adb25e (patch)
tree78afe26b0af7da91e9984224711de2e26b6e9114 /arch/x86/kernel/fpu/signal.c
parentx86/fpu: Add size and mask information to fpstate (diff)
downloadwireguard-linux-be31dfdfd75b172af3ddcfa7511cdc3bb7adb25e.tar.xz
wireguard-linux-be31dfdfd75b172af3ddcfa7511cdc3bb7adb25e.zip
x86/fpu: Use fpstate::size
Make use of fpstate::size in various places which require the buffer size information for sanity checks or memcpy() sizing. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20211013145322.973518954@linutronix.de
Diffstat (limited to 'arch/x86/kernel/fpu/signal.c')
-rw-r--r--arch/x86/kernel/fpu/signal.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index c54c2a3dda44..aa9329189864 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -313,15 +313,13 @@ retry:
static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
bool ia32_fxstate)
{
- int state_size = fpu_kernel_xstate_size;
struct task_struct *tsk = current;
struct fpu *fpu = &tsk->thread.fpu;
struct user_i387_ia32_struct env;
+ bool success, fx_only = false;
union fpregs_state *fpregs;
+ unsigned int state_size;
u64 user_xfeatures = 0;
- bool fx_only = false;
- bool success;
-
if (use_xsave()) {
struct _fpx_sw_bytes fx_sw_user;
@@ -334,6 +332,7 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
user_xfeatures = fx_sw_user.xfeatures;
} else {
user_xfeatures = XFEATURE_MASK_FPSSE;
+ state_size = fpu->fpstate->size;
}
if (likely(!ia32_fxstate)) {