Mailing List Archive

[xen staging] xen/nospec: Remove unreachable code
commit 52bde26c1c651983e396002e2b0aeb8ef414e2d7
Author: Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 10 20:08:03 2024 +0100
Commit: Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Apr 11 13:23:08 2024 +0100

xen/nospec: Remove unreachable code

When CONFIG_SPECULATIVE_HARDEN_LOCK is active, this reads:

static always_inline bool lock_evaluate_nospec(bool condition)
{
return arch_lock_evaluate_nospec(condition);
return condition;
}

Insert an #else to take out the second return.

Fixes: 7ef0084418e1 ("x86/spinlock: introduce support for blocking speculation into critical regions")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
xen/include/xen/nospec.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/nospec.h b/xen/include/xen/nospec.h
index 9fb15aa26a..828dbd4e0a 100644
--- a/xen/include/xen/nospec.h
+++ b/xen/include/xen/nospec.h
@@ -82,8 +82,9 @@ static always_inline bool lock_evaluate_nospec(bool condition)
{
#ifdef CONFIG_SPECULATIVE_HARDEN_LOCK
return arch_lock_evaluate_nospec(condition);
-#endif
+#else
return condition;
+#endif
}

#endif /* XEN_NOSPEC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging