From: Michael Ellerman <mpe@ellerman.id.au>
To: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>,
robh@kernel.org, dan.carpenter@oracle.com
Cc: devicetree@vger.kernel.org, kbuild-all@lists.01.org,
lkp@intel.com, nramas@linux.microsoft.com,
linuxppc-dev@lists.ozlabs.org, bauerman@linux.ibm.com,
dja@axtens.net
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 [thread overview]
Message-ID: <87o8e8ayrt.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20210420190355.10059-2-nramas@linux.microsoft.com>
Lakshmi Ramasubramanian <nramas@linux.microsoft.com> 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 <nramas@linux.microsoft.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>
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 *kernel_buf,
>
> ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info);
> if (ret)
> - goto out;
> + return ERR_PTR(ret);
>
> if (image->type == KEXEC_TYPE_CRASH) {
> /* min & max buffer values for kdump case */
> --
> 2.31.0
next prev parent reply other threads:[~2021-04-21 7:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 19:03 [PATCH 1/2] powerpc: Free fdt on error in elf64_load() Lakshmi Ramasubramanian
2021-04-20 19:03 ` [PATCH 2/2] powerpc: If kexec_build_elf_info() fails return immediately from elf64_load() Lakshmi Ramasubramanian
2021-04-21 7:21 ` Michael Ellerman [this message]
2021-04-21 5:35 ` [PATCH 1/2] powerpc: Free fdt on error in elf64_load() Santosh Sivaraj
2021-04-21 13:58 ` Lakshmi Ramasubramanian
2021-04-21 14:02 ` Santosh Sivaraj
2021-04-21 7:18 ` Michael Ellerman
2021-04-21 14:01 ` Lakshmi Ramasubramanian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o8e8ayrt.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=bauerman@linux.ibm.com \
--cc=dan.carpenter@oracle.com \
--cc=devicetree@vger.kernel.org \
--cc=dja@axtens.net \
--cc=kbuild-all@lists.01.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=nramas@linux.microsoft.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).