]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/x86-speculation-unify-conditional-spectre-v2-print-functions.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / x86-speculation-unify-conditional-spectre-v2-print-functions.patch
CommitLineData
1f91e7a4
GKH
1From foo@baz Tue 14 May 2019 08:29:35 PM CEST
2From: Thomas Gleixner <tglx@linutronix.de>
3Date: Sun, 25 Nov 2018 19:33:44 +0100
4Subject: x86/speculation: Unify conditional spectre v2 print functions
5
6From: Thomas Gleixner <tglx@linutronix.de>
7
8commit 495d470e9828500e0155027f230449ac5e29c025 upstream.
9
10There is no point in having two functions and a conditional at the call
11site.
12
13Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
14Reviewed-by: Ingo Molnar <mingo@kernel.org>
15Cc: Peter Zijlstra <peterz@infradead.org>
16Cc: Andy Lutomirski <luto@kernel.org>
17Cc: Linus Torvalds <torvalds@linux-foundation.org>
18Cc: Jiri Kosina <jkosina@suse.cz>
19Cc: Tom Lendacky <thomas.lendacky@amd.com>
20Cc: Josh Poimboeuf <jpoimboe@redhat.com>
21Cc: Andrea Arcangeli <aarcange@redhat.com>
22Cc: David Woodhouse <dwmw@amazon.co.uk>
23Cc: Tim Chen <tim.c.chen@linux.intel.com>
24Cc: Andi Kleen <ak@linux.intel.com>
25Cc: Dave Hansen <dave.hansen@intel.com>
26Cc: Casey Schaufler <casey.schaufler@intel.com>
27Cc: Asit Mallick <asit.k.mallick@intel.com>
28Cc: Arjan van de Ven <arjan@linux.intel.com>
29Cc: Jon Masters <jcm@redhat.com>
30Cc: Waiman Long <longman9394@gmail.com>
31Cc: Greg KH <gregkh@linuxfoundation.org>
32Cc: Dave Stewart <david.c.stewart@intel.com>
33Cc: Kees Cook <keescook@chromium.org>
34Link: https://lkml.kernel.org/r/20181125185004.986890749@linutronix.de
35Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
36Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37---
38 arch/x86/kernel/cpu/bugs.c | 17 ++++-------------
39 1 file changed, 4 insertions(+), 13 deletions(-)
40
41--- a/arch/x86/kernel/cpu/bugs.c
42+++ b/arch/x86/kernel/cpu/bugs.c
43@@ -249,15 +249,9 @@ static const struct {
44 { "auto", SPECTRE_V2_CMD_AUTO, false },
45 };
46
47-static void __init spec2_print_if_insecure(const char *reason)
48+static void __init spec_v2_print_cond(const char *reason, bool secure)
49 {
50- if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
51- pr_info("%s selected on command line.\n", reason);
52-}
53-
54-static void __init spec2_print_if_secure(const char *reason)
55-{
56- if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
57+ if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2) != secure)
58 pr_info("%s selected on command line.\n", reason);
59 }
60
61@@ -305,11 +299,8 @@ static enum spectre_v2_mitigation_cmd __
62 return SPECTRE_V2_CMD_AUTO;
63 }
64
65- if (mitigation_options[i].secure)
66- spec2_print_if_secure(mitigation_options[i].option);
67- else
68- spec2_print_if_insecure(mitigation_options[i].option);
69-
70+ spec_v2_print_cond(mitigation_options[i].option,
71+ mitigation_options[i].secure);
72 return cmd;
73 }
74