[PATCH] automount: check for recursive automount

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Jul 3 02:33:21 PDT 2014


On Thu, Jul 03, 2014 at 11:00:45AM +0200, Alessandro Rubini wrote:
> > static variables are initialized to 0 (for pointers: NULL) by the
> > compiler.
> 
> Well, not really. The compiler just places them in the .bss area.  It
> is barebox, it is run-time initialization, that zeroes bss.
> 
> So it is barebox, not the compiler.
Yeah, in general it's even worse because there might be platforms where
NULL isn't represented by a literal 0. (Not sure if something like this
exists, but it's allowed by the standard.)

C99 tells us:

If an object that has automatic storage duration is not initialized explicitly,
its value is indeterminate. If an object that has static storage duration is
not initialized explicitly, then:
- if it has pointer type, it is initialized to a null pointer;
- if it has arithmetic type, it is initialized to (positive or unsigned) zero;
- if it is an aggregate, every member is initialized (recursively) according to
  these rules;
- if it is a union, the first named member is initialized (recursively)
  according to these rules.

I assume it's included in earlier standards, too, but I don't have these
handy.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the barebox mailing list