[PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load()
Segher Boessenkool
segher at kernel.crashing.org
Fri Apr 23 02:54:37 AEST 2021
On Thu, Apr 22, 2021 at 08:05:27AM +0000, David Laight wrote:
> > (Does anyone - and by anyone I mean any large distro - compile with
> > local variables inited by the compiler?)
>
> There are compilers that initialise locals to zero for 'debug' builds
> and leave the 'random' for optimised 'release' builds.
> Lets not test what we are releasing!
Yeah, that's the worst of all possible worlds.
> I also think there is a new option to gcc (or clang?) to initialise
> on-stack structures and arrays to ensure garbage isn't passed.
> That seems to be a horrid performance hit!
> Especially in userspace where large stack allocations are almost free.
>
> Any auto-initialise ought to be with a semi-random value
> (especially not zero) so that it is never right and doesn't
> lead to lazy coding.
Many compilers did something like this, decades ago -- for debug builds.
Segher
More information about the Linuxppc-dev
mailing list