Content-Type: multipart/mixed; boundary="===============6556134950901871611==" MIME-Version: 1.0 From: Michael Ellerman To: kbuild-all@lists.01.org Subject: Re: [PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load() Date: Fri, 23 Apr 2021 23:50:49 +1000 Message-ID: <875z0daz46.fsf@mpe.ellerman.id.au> In-Reply-To: <87r1j3ys8i.fsf@dja-thinkpad.axtens.net> List-Id: --===============6556134950901871611== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Daniel Axtens writes: > Daniel Axtens writes: > >> Hi Lakshmi, >> >>> On 4/15/21 12:14 PM, Lakshmi Ramasubramanian wrote: >>> >>> Sorry - missed copying device-tree and powerpc mailing lists. >>> >>>> There are a few "goto out;" statements before the local variable "fdt" >>>> is initialized through the call to of_kexec_alloc_and_setup_fdt() in >>>> elf64_load(). This will result in an uninitialized "fdt" being passed >>>> to kvfree() in this function if there is an error before the call to >>>> of_kexec_alloc_and_setup_fdt(). >>>> = >>>> Initialize the local variable "fdt" to NULL. >>>> >> I'm a huge fan of initialising local variables! But I'm struggling to >> find the code path that will lead to an uninit fdt being returned... > > OK, so perhaps this was putting it too strongly. I have been bitten > by uninitialised things enough in C that I may have taken a slightly > overly-agressive view of fixing them in the source rather than the > compiler. I do think compiler-level mitigations are better, and I take > the point that we don't want to defeat compiler checking. > > (Does anyone - and by anyone I mean any large distro - compile with > local variables inited by the compiler?) This is where I say, "yes, Android" and you say "ugh no I meant a real distro", and I say "well ...". But yeah doesn't help us much. cheers --===============6556134950901871611==--