Skip to contentSkip to conversation

x86/fpu/signal: save_xstate_epilog: fix return polarity

PATCH Applied Anders Roxell 3 participants 3 messages Sep 22, 2021 – Sep 23, 2021 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/fpu/signal: save_xstate_epilog: fix return polarity

Fix the missing return code polarity in function 'save_xstate_epilog()'.

Fixes a2a8fd9a3efd ("x86/fpu/signal: Change return code of restore_fpregs_from_user() to boolean")
---
 arch/x86/kernel/fpu/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/signal.c +1 -1
index 68f03da2012e..39c7bae97daf 100644
@@ -106,7 +106,7 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame)
 	err = __copy_to_user(&x->i387.sw_reserved, sw_bytes, sizeof(*sw_bytes));
 
 	if (!use_xsave())
-		return err;
+		return !err;
 
 	err |= __put_user(FP_XSTATE_MAGIC2,
 			  (__u32 __user *)(buf + fpu_user_xstate_size));
Signature · 1 line
2.33.0
merge bot Applied
#1 lore raw

[tip: x86/fpu] x86/fpu/signal: Fix missed conversion to correct boolean retval in save_xstate_epilog()

The following commit has been merged into the x86/fpu branch of tip:

The following commit has been merged into the x86/fpu branch of tip:

Commit-ID:     724fc0248d450224b19ef5b5ee41e392348f6704
Gitweb:        https://git.kernel.org/tip/724fc0248d450224b19ef5b5ee41e392348f6704
Author:        Anders Roxell <[email protected]>
AuthorDate:    Wed, 22 Sep 2021 22:09:01 +02:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Thu, 23 Sep 2021 10:52:20 +02:00

x86/fpu/signal: Fix missed conversion to correct boolean retval in save_xstate_epilog()

Fix the missing return code polarity in save_xstate_epilog().

[ bp: Massage, use the right commit in the Fixes: tag ]

Fixes 2af07f3a6e9f ("x86/fpu/signal: Change return type of copy_fpregs_to_sigframe() helpers to boolean")
---
 arch/x86/kernel/fpu/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/signal.c +1 -1
index 68f03da..39c7bae 100644
@@ -106,7 +106,7 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame)
 	err = __copy_to_user(&x->i387.sw_reserved, sw_bytes, sizeof(*sw_bytes));
 
 	if (!use_xsave())
-		return err;
+		return !err;
 
 	err |= __put_user(FP_XSTATE_MAGIC2,
 			  (__u32 __user *)(buf + fpu_user_xstate_size));
Tested-by kernelci.org bot on v1 1/1
#2 lore raw
In reply to Anders Roxell
Quoted 18 lines · Anders Roxell

Fix the missing return code polarity in function 'save_xstate_epilog()'.

Fixes a2a8fd9a3efd ("x86/fpu/signal: Change return code of restore_fpregs_from_user() to boolean")
---
 arch/x86/kernel/fpu/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/signal.c +0 -0
index 68f03da2012e..39c7bae97daf 100644

arch/x86/kernel/fpu/signal.c static inline bool save_xstate_epilog(void __user *buf, int ia32_frame) · line 112

Quoted 8 lines
arch/x86/kernel/fpu/signal.c +1 -1
@@ -106,7 +106,7 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame)
 	err = __copy_to_user(&x->i387.sw_reserved, sw_bytes, sizeof(*sw_bytes));
 
 	if (!use_xsave())
-		return err;
+		return !err;
 
 	err |= __put_user(FP_XSTATE_MAGIC2,
 			  (__u32 __user *)(buf + fpu_user_xstate_size));

This patch has probably been applied already, but since the issue got bisected and then the fix was verified by KernelCI:

For the record, see more details about it here:

https://github.com/kernelci/kernelci-project/issues/53

Best wishes,
Guillaume