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
| ||
|
Date: Tue, 13 Jun 2017 12:30:23 -0700 From: Joe Perches <joe@...ches.com> To: Juergen Gross <jgross@...e.com>, Ingo Molnar <mingo@...nel.org> Cc: linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org, x86@...nel.org, boris.ostrovsky@...cle.com, hpa@...or.com, tglx@...utronix.de, mingo@...hat.com, tony.luck@...el.com, bp@...en8.de Subject: Re: [PATCH v2] xen/mce: don't issue error message for failed /dev/mcelog registration On Tue, 2017-06-13 at 21:27 +0200, Juergen Gross wrote: > On 13/06/17 18:31, Joe Perches wrote: > > On Tue, 2017-06-13 at 18:13 +0200, Juergen Gross wrote: > > > On 13/06/17 17:20, Ingo Molnar wrote: > > > > * Juergen Gross <jgross@...e.com> wrote: > > > > > > > > > When running under Xen as dom0 /dev/mcelog is being registered by Xen > > > > > instead of the normal mcelog driver. Avoid an error message being > > > > > issued by the mcelog driver in this case. Instead issue an informative > > > > > message that Xen has registered the device. > > > > [] > > > > > diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c > > > > [] > > > > > @@ -388,9 +388,16 @@ static __init int dev_mcelog_init_device(void) > > > > > /* register character device /dev/mcelog */ > > > > > err = misc_register(&mce_chrdev_device); > > > > > if (err) { > > > > > - pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err); > > > > > - return err; > > > > > + if (err == -EBUSY) > > > > > + /* Xen dom0 might have registered the device already. */ > > > > > + pr_info("Unable to init device /dev/mcelog, already registered"); > > > > > + else { > > > > > + pr_err("Unable to init device /dev/mcelog (rc: %d)\n", > > > > > + err); > > > > > + return err; > > > > > + } > > > > > > > > Please only use balanced curly braces in conditional statements. > > > > > > Okay, will change. > > > > Perhaps better is to reverse the test > > > > if (err != -EBUSY) { > > pr_err("Unable to ....", err); > > return err; > > } > > pr_info("etc..."); > > Okay. > > > > > [ rest of code at this indentation ] > > > > but it looks like you added a logic defect too and > > this code should be: > > > > if (err) { > > if (err == -EBUSY) > > pr_info(...) > > else > > pr_err(...) > > return err; > > } > > > > or less indented using > > > > err = misc_register(&mce_chrdev_device); > > if (err == -EBUSY) { > > pr_info(...); > > return err; > > } else if (err) { > > pr_err(...); > > return err; > > } > > I didn't want to omit the call to mce_register_decode_chain() in the Xen > case. You should definitely mention that behavior change in the changelog.
Powered by blists - more mailing lists