Since slurp_decompress_file() allocates the buffer to hold the content
read from the file, no need to allocate the buffer again.

Signed-off-by: Pingfan Liu <pi...@redhat.com>
To: kexec@lists.infradead.org
Cc: ho...@verge.net.au
Cc: a...@kernel.org
Cc: jeremy.lin...@arm.com

---
 kexec/arch/arm64/kexec-zImage-arm64.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/kexec/arch/arm64/kexec-zImage-arm64.c 
b/kexec/arch/arm64/kexec-zImage-arm64.c
index 6ee82ff..166d7ef 100644
--- a/kexec/arch/arm64/kexec-zImage-arm64.c
+++ b/kexec/arch/arm64/kexec-zImage-arm64.c
@@ -67,15 +67,6 @@ int zImage_arm64_probe(const char *kernel_buf, off_t 
kernel_size)
                goto fail_mkstemp;
        }
 
-       kernel_uncompressed_buf =
-               (char *) calloc(kernel_size, sizeof(off_t));
-       if (!kernel_uncompressed_buf) {
-               dbgprintf("%s: Can't calloc %ld bytes\n",
-                               __func__, kernel_size);
-               ret= -ENOMEM;
-               goto fail_calloc;
-       }
-
        /* slurp in the input kernel */
        dbgprintf("%s: ", __func__);
        kernel_uncompressed_buf = slurp_decompress_file(kernel_buf,
@@ -128,7 +119,6 @@ int zImage_arm64_probe(const char *kernel_buf, off_t 
kernel_size)
 fail_bad_header:
        free(kernel_uncompressed_buf);
 
-fail_calloc:
        if (fd >= 0)
                close(fd);
 
-- 
2.31.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to