2006-12-04 12:06:53

by Horst H. von Brand

[permalink] [raw]
Subject: Re: [Openipmi-developer] [PATCH 9/12] IPMI: add pigeonpoint poweroff

Randy Dunlap <[email protected]> wrote:
> Bela Lubkin wrote:
> > Andrew Morton wrote:
> >
> >>> Sometime, please go through the IPMI code looking for all these
> >>> statically-allocated things which are initialised to 0 or NULL and remove
> >>> all those intialisations? They're unneeded, they increase the vmlinux
> >>> image size and there are quite a number of them. Thanks.
> > Randy Dunlop replied:
> >
> >> I was just about to send that patch. Here it is,
> >> on top of the series-of-12.
> > ...
> >> -static int bt_debug = BT_DEBUG_OFF;
> >> +static int bt_debug;
> > Is it wise to significantly degrade code readability to work around
> > a minor
> > compiler / linker bug?
>
> Is that the only one that is a problem?
>
> I don't think it's a problem. We *know* that static data areas
> are init to 0. Everything depends on that. If that didn't work
> it would all break.

Right. And we know NULL == 0.

> I could say that it's a nice coincidence that BT_DEBUG_OFF == 0,
> but I think that it's more than coincidence.

I'd have had to look over the code to find out what it was initialized
to. In cases where it is not an explicit 0/NULL, I'd leave it as is. It
could also break if somebody later on changes the value of BT_DEBUG_OFF
(yes, very unlikely, but...).

Bug your friendly GCC guy to loose static initializations to zero
(shouldn't be /that/ hard to do...) instead of obfuscating kernel's code.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513