From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: robh@kernel.org, dan.carpenter@oracle.com, mpe@ellerman.id.au
Cc: bauerman@linux.ibm.com, dja@axtens.net,
christophe.leroy@csgroup.eu, nramas@linux.microsoft.com,
lkp@intel.com, kbuild-all@lists.01.org,
devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH v2 2/2] powerpc: If kexec_build_elf_info() fails return immediately from elf64_load()
Date: Wed, 21 Apr 2021 09:36:10 -0700 [thread overview]
Message-ID: <20210421163610.23775-2-nramas@linux.microsoft.com> (raw)
In-Reply-To: <20210421163610.23775-1-nramas@linux.microsoft.com>
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>
---
arch/powerpc/kexec/elf_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 16:36 [PATCH v2 1/2] powerpc: Free fdt on error in elf64_load() Lakshmi Ramasubramanian
2021-04-21 16:36 ` Lakshmi Ramasubramanian [this message]
2021-04-26 21:26 ` [PATCH v2 2/2] powerpc: If kexec_build_elf_info() fails return immediately from elf64_load() Rob Herring
2021-04-23 17:34 ` [PATCH v2 1/2] powerpc: Free fdt on error in elf64_load() Lakshmi Ramasubramanian
2021-04-26 21:25 ` Rob Herring
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=20210421163610.23775-2-nramas@linux.microsoft.com \
--to=nramas@linux.microsoft.com \
--cc=bauerman@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--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=mpe@ellerman.id.au \
--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).