From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 21 Feb 2019 14:04:45 -0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gwoxv-0007HS-OX for speck@linutronix.de; Thu, 21 Feb 2019 15:04:44 +0100 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 081D2B02D for ; Thu, 21 Feb 2019 14:04:38 +0000 (UTC) Date: Thu, 21 Feb 2019 15:04:30 +0100 From: Borislav Petkov Subject: [MODERATED] Re: [patch V2 08/10] MDS basics+ 8 Message-ID: <20190221140430.GG13125@zn.tnic> References: <20190220150753.665964899@linutronix.de> <20190220151400.682732169@linutronix.de> MIME-Version: 1.0 In-Reply-To: <20190220151400.682732169@linutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Wed, Feb 20, 2019 at 04:08:01PM +0100, speck for Thomas Gleixner wrote: > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -221,7 +221,8 @@ static enum mds_mitigations mds_mitigati > =20 > static const char * const mds_strings[] =3D { > [MDS_MITIGATION_OFF] =3D "Vulnerable", > - [MDS_MITIGATION_FULL] =3D "Mitigation: Clear CPU buffers" > + [MDS_MITIGATION_FULL] =3D "Mitigation: Clear CPU buffers", > + [MDS_MITIGATION_HOPE] =3D "Vulnerable: Clear CPU buffers attempted, no mi= crocode", > }; > =20 > static void mds_select_mitigation(void) > @@ -236,12 +237,12 @@ static void mds_select_mitigation(void) > break; > case MDS_MITIGATION_AUTO: > case MDS_MITIGATION_FULL: > - if (boot_cpu_has(X86_FEATURE_MD_CLEAR)) { > + case MDS_MITIGATION_HOPE: Now we have: switch (mds_mitigation) { case MDS_MITIGATION_OFF: break; case MDS_MITIGATION_AUTO: case MDS_MITIGATION_FULL: case MDS_MITIGATION_HOPE: I guess that switch-case statement becomes not really useful and we can do an early exit with a simple if: if (mds_mitigation =3D=3D MDS_MITIGATION_OFF) goto print; /* do rest here */ --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20