Skip to content

Commit 031cc26

Browse files
nramasrobherring
authored andcommitted
powerpc: If kexec_build_elf_info() fails return immediately from elf64_load()
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 <[email protected]> Reported-by: Dan Carpenter <[email protected]> Reviewed-by: Michael Ellerman <[email protected]> Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a45dd98 commit 031cc26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/powerpc/kexec/elf_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void *elf64_load(struct kimage *image, char *kernel_buf,
4545

4646
ret = kexec_build_elf_info(kernel_buf, kernel_len, &ehdr, &elf_info);
4747
if (ret)
48-
goto out;
48+
return ERR_PTR(ret);
4949

5050
if (image->type == KEXEC_TYPE_CRASH) {
5151
/* min & max buffer values for kdump case */

0 commit comments

Comments
 (0)