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]
Message-ID: <20110527075409.GA19300@elte.hu>
Date:	Fri, 27 May 2011 09:54:09 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Borislav Petkov <bp@...en8.de>,
	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH 03/12] mce-severity: cleanup severity table


* Borislav Petkov <bp@...en8.de> wrote:

> > -	BITCLR(
> > -		MCI_STATUS_VAL,
> > -		NO, "Invalid"
> > +	MCESEV(
> > +		NO, "Invalid",
> > +		BITCLR(MCI_STATUS_VAL)
> >  		),
> > -	BITCLR(
> > -		MCI_STATUS_EN,
> > -		NO, "Not enabled"
> > +	MCESEV(
> > +		NO, "Not enabled",
> > +		BITCLR(MCI_STATUS_EN)
> >  		),
> > -	BITSET(
> > -		MCI_STATUS_PCC,
> > -		PANIC, "Processor context corrupt"
> > +	MCESEV(
> > +		PANIC, "Processor context corrupt",
> > +		BITSET(MCI_STATUS_PCC)
> >  		),
> 
> I'm still wondering whether using the gcc struct assignment syntax could
> make those much more readable instead of changing the macro inclusion:
> 
> 	{
> 		.sev	= MCE_PANIC_SEVERITY,
> 		.msg	= "Processor context corrupt",
> 		.mask	= MCI_STATUS_PCC,
> 		.result	= MCI_STATUS_PCC,
> 	},
> 	...

Hidetoshi's version was already an improvement over what we have 
currently (what we have now is largely unreadable), but your variant 
looks even more readable and isnt all that much longer either.

So, the case for macros is where the initialization can be compressed 
into a single *readable* line. If that cannot be done then the least 
obfuscated version is generally the better one.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ