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:	Thu, 13 Oct 2011 17:04:47 -0300
From:	Mauro Carvalho Chehab <mchehab@...hat.com>
To:	Borislav Petkov <bp@...64.org>
CC:	"Luck, Tony" <tony.luck@...el.com>,
	Niklas Söderlund <niso@....se>,
	"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i7core_edac: fix erroneous size of static array

Em 13-10-2011 16:14, Borislav Petkov escreveu:
> On Thu, Oct 13, 2011 at 03:03:20PM -0400, Luck, Tony wrote:
>>> -	static int cols[8] = {
>>> +	static int cols[4] = {
>>
>> Why are these arrays "static"? Does that generate better code than
>> dynamic initialization?
> 
> They look like lookup arrays for count of things based on bit settings
> and as such they should be static because they don't ... change :). If
> they were dynamic, then inlining them in every function callsite would
> be not cool.

Btw, it probably makes sense to also declare as "const". In this specific case,
it is likely that gcc will discover that it is const anyway, and do some
optimization, but sometimes gcc don't do what I would expect ;)

Mauro.
--
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