Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8119312imu; Tue, 4 Dec 2018 03:19:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/XPIpHD39OZ4L2Za6UWyaW8e61YK41Y3ralqjoQvUJuJSoL74ZnTCjVDmTkDzffnd2w+e4b X-Received: by 2002:a63:554b:: with SMTP id f11mr16889621pgm.37.1543922398930; Tue, 04 Dec 2018 03:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543922398; cv=none; d=google.com; s=arc-20160816; b=a9L09C+koZwiqt9X7VvzjgO+XFHxjDCjMe55YilZkBVipMhaLLHkLoDF7iHfnXt9Wm nr+NZyoeaFriZHVfr7uYtM7i1g2/l1qBOfcKOqXuRcRBDb4tTZHA8N1T1U75s2KCRCmH ov/04yRODYroYF7pQUonuC4dBguYkDTpY+OWdbNmqEnwkP1HXff7NwNWgeCY0Lrw13j1 4UL3SPtZd+KgI/Qvr7IQ7zNzyCH6XDHCVcXjDm/czLxG2DhfcMORiOU6WXZ/8UQ4JIeX s6zzsKbvmlGBYSNRl1vzNUoBCR5HId5vTZR4T2iVOcD98h0pvaXrZ9SOWHNDTGBHfZ0V J1Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sxpd+vaOTth6rjK2jxuIEWj9talJkS7gm2kNLazIJSQ=; b=po+E7X094LZzjx+mEDEDxdGAVWzHmkDyUH7PSAuu1OO1cFqogJoJxwfs//kTnlUiQk 0EtCUot2P7gAN/4RWyq5r3q/RG4BsMkuFCEjgkFulBXsZIWPU987lq5cDWXawl3+aoHf eovaurkdZP91CobNjuiTMC1ts/HQ+gQgf7knK2Dls/pOBDXpJwFX4PwnJI2FrD+KjhpX rwB/NUyrOrivJdtJvv/J3AI2AwZ3pabOrwlAapZR2pyYXC++QyHlINhDKkQCjOZSyZ7J wzhzrvDe8M6C54WhB7Hi40Yx1rDQFA9GkmLN1GF8lbJqw3cj9BED7+NGOBxDreRZ4mA8 /ppQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mKJEDFVO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68si16954153pfb.101.2018.12.04.03.19.43; Tue, 04 Dec 2018 03:19:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mKJEDFVO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbeLDLSD (ORCPT + 99 others); Tue, 4 Dec 2018 06:18:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:52524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727674AbeLDLFE (ORCPT ); Tue, 4 Dec 2018 06:05:04 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 415642154B; Tue, 4 Dec 2018 11:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921502; bh=f2krCO6Bwl+jQxo6X75vj32nZy3FddXYIOkYkewyk3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mKJEDFVOQtLfx5SVX2Ix6qy5YIgtI8wL10OOdYAxERsUG6esuiDAC6WQ+cOstCNiV Ot/TnHvPC5gHay/R/6MR720TtlXDLcLRCk0HAQqTRhhDspiC26WyXH2GzXUmNdus8+ +tMQ6YHh/KpgbpFhjIqiKor3CmVQ/OuGhXB4lcQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Linus Torvalds , Jiri Kosina , Tom Lendacky , Josh Poimboeuf , Andrea Arcangeli , David Woodhouse , Tim Chen , Andi Kleen , Dave Hansen , Casey Schaufler , Asit Mallick , Arjan van de Ven , Jon Masters , Waiman Long , Dave Stewart , Kees Cook Subject: [PATCH 4.14 095/146] x86/speculation: Unify conditional spectre v2 print functions Date: Tue, 4 Dec 2018 11:49:41 +0100 Message-Id: <20181204103730.646854830@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103726.750894136@linuxfoundation.org> References: <20181204103726.750894136@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner tglx@linutronix.de commit 495d470e9828500e0155027f230449ac5e29c025 upstream There is no point in having two functions and a conditional at the call site. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Cc: Peter Zijlstra Cc: Andy Lutomirski Cc: Linus Torvalds Cc: Jiri Kosina Cc: Tom Lendacky Cc: Josh Poimboeuf Cc: Andrea Arcangeli Cc: David Woodhouse Cc: Tim Chen Cc: Andi Kleen Cc: Dave Hansen Cc: Casey Schaufler Cc: Asit Mallick Cc: Arjan van de Ven Cc: Jon Masters Cc: Waiman Long Cc: Greg KH Cc: Dave Stewart Cc: Kees Cook Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20181125185004.986890749@linutronix.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/bugs.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -256,15 +256,9 @@ static const struct { { "auto", SPECTRE_V2_CMD_AUTO, false }, }; -static void __init spec2_print_if_insecure(const char *reason) +static void __init spec_v2_print_cond(const char *reason, bool secure) { - if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) - pr_info("%s selected on command line.\n", reason); -} - -static void __init spec2_print_if_secure(const char *reason) -{ - if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2)) + if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2) != secure) pr_info("%s selected on command line.\n", reason); } @@ -307,11 +301,8 @@ static enum spectre_v2_mitigation_cmd __ return SPECTRE_V2_CMD_AUTO; } - if (mitigation_options[i].secure) - spec2_print_if_secure(mitigation_options[i].option); - else - spec2_print_if_insecure(mitigation_options[i].option); - + spec_v2_print_cond(mitigation_options[i].option, + mitigation_options[i].secure); return cmd; }