Content-Type: multipart/mixed; boundary="===============3039002652235155881==" MIME-Version: 1.0 From: Michael Ellerman To: kbuild-all@lists.01.org Subject: Re: [PATCH 2/2] powerpc: If kexec_build_elf_info() fails return immediately from elf64_load() Date: Wed, 21 Apr 2021 17:21:26 +1000 Message-ID: <87o8e8ayrt.fsf@mpe.ellerman.id.au> In-Reply-To: <20210420190355.10059-2-nramas@linux.microsoft.com> List-Id: --===============3039002652235155881== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Lakshmi Ramasubramanian writes: > Uninitialized local variable "elf_info" would be passed to > kexec_free_elf_info() if kexec_build_elf_info() returns an error > in elf64_load(). > > If kexec_build_elf_info() returns an error, return the error > immediately. > > Signed-off-by: Lakshmi Ramasubramanian > Reported-by: Dan Carpenter Reviewed-by: Michael Ellerman cheers > diff --git a/arch/powerpc/kexec/elf_64.c b/arch/powerpc/kexec/elf_64.c > index 02662e72c53d..eeb258002d1e 100644 > --- a/arch/powerpc/kexec/elf_64.c > +++ b/arch/powerpc/kexec/elf_64.c > @@ -45,7 +45,7 @@ static void *elf64_load(struct kimage *image, char *ker= nel_buf, > = > ret =3D kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info); > if (ret) > - goto out; > + return ERR_PTR(ret); > = > if (image->type =3D=3D KEXEC_TYPE_CRASH) { > /* min & max buffer values for kdump case */ > -- = > 2.31.0 --===============3039002652235155881==--