x86: Avoid unnecessary __clear_user() and xrstor in signal handling
[deliverable/linux.git] / arch / x86 / include / asm / xsave.h
index 2c4390cae22883014816647319fb6569d6867c2c..30dfc81804d52d57ddba73e631af31ecae1846ec 100644 (file)
@@ -59,6 +59,16 @@ static inline int fpu_xrstor_checking(struct fpu *fpu)
 static inline int xsave_user(struct xsave_struct __user *buf)
 {
        int err;
+
+       /*
+        * Clear the xsave header first, so that reserved fields are
+        * initialized to zero.
+        */
+       err = __clear_user(&buf->xsave_hdr,
+                          sizeof(struct xsave_hdr_struct));
+       if (unlikely(err))
+               return -EFAULT;
+
        __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n"
                             "2:\n"
                             ".section .fixup,\"ax\"\n"
This page took 0.024065 seconds and 5 git commands to generate.