lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Sep 2021 13:23:28 +0000
From:   "Luck, Tony" <tony.luck@...el.com>
To:     Borislav Petkov <bp@...en8.de>
CC:     Yazen Ghannam <yazen.ghannam@....com>, X86 ML <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/4] x86/mce: Get rid of msr_ops

Looks nice. I don’t think you need those “break;” after each “return …;”

Sent from my iPhone

> On Sep 22, 2021, at 05:18, Borislav Petkov <bp@...en8.de> wrote:
> 
> On Mon, Sep 20, 2021 at 10:32:11AM +0200, Borislav Petkov wrote:
>> but please don't make me add more helper functions. Those MSR defines
>> already have "SMCA" and "IA32" in their names so that should be a good
>> enough differentiation, I'd say.
> 
> I just had a better idea - it is compact but regular and one can see at
> a quick glance which block is for which set of MSRs:
> 
> u32 mca_msr_reg(int bank, enum mca_msr reg)
> {
>        if (mce_flags.smca) {
>                switch (reg) {
>                case MCA_CTL:    return MSR_AMD64_SMCA_MCx_CTL(bank);    break;
>                case MCA_ADDR:   return MSR_AMD64_SMCA_MCx_ADDR(bank);   break;
>                case MCA_MISC:   return MSR_AMD64_SMCA_MCx_MISC(bank);   break;
>                case MCA_STATUS: return MSR_AMD64_SMCA_MCx_STATUS(bank); break;
>                default: goto out; break;
>                }
>        }
> 
>        switch (reg) {
>        case MCA_CTL:    return MSR_IA32_MCx_CTL(bank);    break;
>        case MCA_ADDR:   return MSR_IA32_MCx_ADDR(bank);   break;
>        case MCA_MISC:   return MSR_IA32_MCx_MISC(bank);   break;
>        case MCA_STATUS: return MSR_IA32_MCx_STATUS(bank); break;
>        default: goto out; break;
>        }
> 
> out:
>        WARN_ON_ONCE(1);
>        return 0;
> }
> 
> -- 
> Regards/Gruss,
>    Boris.
> 
> https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ