Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8097522imu; Tue, 4 Dec 2018 02:58:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/XfROWu0Z5KpX/e7hzm4SZK0xkqmHU1u7OQGcpYliH/3+6184Pl/aEnXosj4W+O1A+TJBTX X-Received: by 2002:a63:bd51:: with SMTP id d17mr16649556pgp.443.1543921104935; Tue, 04 Dec 2018 02:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921104; cv=none; d=google.com; s=arc-20160816; b=aiavmuFRRdwEOVIa3Gs6cQtCSjfnLbhB1J8560l3UMwb69x4a5gRjKp2iDMty4FtyV DHSQcnIHlz2Tqc9t9KSwquDJBUlA5gVV7PsBH0ufxjceS+0UqER0fv5PYDgMpEm5MM+0 Yz6xMiQ/6CYkVtiw8B+faob1i9Yey79PYirC9nBFUj9afVqYxzw9V68kiV/rH+ab/zfD wdgCq8xSU48HJlKbL/HLiiYUozSlua0xZx3PsJrqFNf4Np5rFEHN/RKWn4z3zCetje6S VFdCyYiXu1LGN0NjBjxSYcCj5KV7KkwjR+pKHgAcpv9LVicF1BoGGA83mTTVFjFPVkfQ ja8w== 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=9m3AipYMFjA3SWtucwhvpsMIu4b41RJWSOOzQGa8ILQ=; b=HF8Qvex4Hh68B99TBT8h34M4nNdZ4ur65ja6wK2HZ89L6+Ro8weu3x4MnNUU9P4AkV 4Knv/X5+Nvgne3vn8If5uUqJOGpeIpxj/pFkFhHWPtCcW+VoRzFzHdftnOmCOF+5ngnd e/tSqoROiXU7/vpnXztHP6DQAIiCsMyotIss7PdgJ3+1gTPVYYFQ2NLU7WHrDTIIkhxN pOQADcp/1aHgY8z1bwKGESTUqBLxAiOLgYJi24IT2vo6ROryhkti4P5mSupJHNtKp2Fj JcE14FMDgCuSc3p9wKGsGvhVOusoaAo3Jy/isoAuqYufpkWQuMgsG81deBtoeQx/81Jb eDKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f48K1v3i; 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 m35si14585698pgb.246.2018.12.04.02.58.09; Tue, 04 Dec 2018 02:58:24 -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=f48K1v3i; 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 S1726624AbeLDK46 (ORCPT + 99 others); Tue, 4 Dec 2018 05:56:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:40492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726611AbeLDK45 (ORCPT ); Tue, 4 Dec 2018 05:56:57 -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 1BC5D214DB; Tue, 4 Dec 2018 10:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921016; bh=tWchYCReZPYjyxo7V2NnkjRQmEDKGkwol9dpIYsDOMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f48K1v3ixMOtK/CtaErvABo5HGPvks2Ee2mBsqJ6mB5E2PVgXKd+q6rP8fdoQ7V1A h+KliosaOcitjmLCKnZ4D3JcJAAE/czE36DMzNttkVVwSj8Tfph6qGRN4mCQXZlhiZ 6sZbzllnTZck/d/4f+KNnOh8b6eROpuyH2P50/YI= 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.19 048/139] x86/speculation: Unify conditional spectre v2 print functions Date: Tue, 4 Dec 2018 11:48:49 +0100 Message-Id: <20181204103651.957578835@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@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.19-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 @@ -257,15 +257,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); } @@ -308,11 +302,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; }