From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5338227563979091351==" MIME-Version: 1.0 From: Lakshmi Ramasubramanian To: kbuild-all@lists.01.org Subject: [PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load() Date: Thu, 15 Apr 2021 12:14:37 -0700 Message-ID: <20210415191437.20212-1-nramas@linux.microsoft.com> List-Id: --===============5338227563979091351== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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. Signed-off-by: Lakshmi Ramasubramanian Reported-by: kernel test robot Reported-by: Dan Carpenter --- 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 5a569bb51349..0051440c1f77 100644 --- a/arch/powerpc/kexec/elf_64.c +++ b/arch/powerpc/kexec/elf_64.c @@ -32,7 +32,7 @@ static void *elf64_load(struct kimage *image, char *kerne= l_buf, int ret; unsigned long kernel_load_addr; unsigned long initrd_load_addr =3D 0, fdt_load_addr; - void *fdt; + void *fdt =3D NULL; const void *slave_code; struct elfhdr ehdr; char *modified_cmdline =3D NULL; -- = 2.31.0 --===============5338227563979091351==--