]> Git Repo - linux.git/commitdiff
powerpc: If kexec_build_elf_info() fails return immediately from elf64_load()
authorLakshmi Ramasubramanian <[email protected]>
Wed, 21 Apr 2021 16:36:10 +0000 (09:36 -0700)
committerRob Herring <[email protected]>
Mon, 26 Apr 2021 21:28:26 +0000 (16:28 -0500)
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]
arch/powerpc/kexec/elf_64.c

index 02662e72c53dc4557b4b32a5f555975665e22adc..eeb258002d1e020f3cb2402d7ae81ff7ce07de30 100644 (file)
@@ -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 */
This page took 0.05225 seconds and 4 git commands to generate.