58 lines
1.9 KiB
Diff
58 lines
1.9 KiB
Diff
|
|
From 6ef59c03bf2c42f6577c708b58598868e8e8fb0b Mon Sep 17 00:00:00 2001
|
||
|
|
From: Bhupesh Sharma <bhsharma@redhat.com>
|
||
|
|
Date: Mon, 15 Jul 2019 11:32:54 +0530
|
||
|
|
Subject: [PATCH 16/20] kexec-uImage-arm64.c: Fix return value of
|
||
|
|
uImage_arm64_probe()
|
||
|
|
|
||
|
|
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=6ef59c03bf2c42f6577c708b58598868e8e8fb0b
|
||
|
|
|
||
|
|
Commit bf06cf2095e1 ("kexec/uImage: probe to identify a corrupted image"),
|
||
|
|
defined the 'uImage_probe_kernel()' function return values and
|
||
|
|
correspondingly ;uImage_arm64_probe()' returns the same (0 -> If the
|
||
|
|
image is valid 'type' image, -1 -> If the image is corrupted and
|
||
|
|
1 -> If the image is not a uImage).
|
||
|
|
|
||
|
|
This causes issues because, in later patches we introduce zImage
|
||
|
|
support for arm64, and since it is probed after uImage, the return
|
||
|
|
values from 'uImage_arm64_probe()' needs to be fixed to make sure
|
||
|
|
that kexec will not return with an invalid error code.
|
||
|
|
|
||
|
|
Now, 'uImage_arm64_probe()' returns the following values instead:
|
||
|
|
0 - valid uImage.
|
||
|
|
-1 - uImage is corrupted.
|
||
|
|
1 - image is not a uImage.
|
||
|
|
|
||
|
|
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||
|
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||
|
|
---
|
||
|
|
kexec/arch/arm64/kexec-uImage-arm64.c | 13 ++++++++++++-
|
||
|
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/kexec/arch/arm64/kexec-uImage-arm64.c b/kexec/arch/arm64/kexec-uImage-arm64.c
|
||
|
|
index 126ea9c..c466913 100644
|
||
|
|
--- a/kexec/arch/arm64/kexec-uImage-arm64.c
|
||
|
|
+++ b/kexec/arch/arm64/kexec-uImage-arm64.c
|
||
|
|
@@ -11,7 +11,18 @@
|
||
|
|
|
||
|
|
int uImage_arm64_probe(const char *buf, off_t len)
|
||
|
|
{
|
||
|
|
- return uImage_probe_kernel(buf, len, IH_ARCH_ARM64);
|
||
|
|
+ int ret;
|
||
|
|
+
|
||
|
|
+ ret = uImage_probe_kernel(buf, len, IH_ARCH_ARM64);
|
||
|
|
+
|
||
|
|
+ /* 0 - valid uImage.
|
||
|
|
+ * -1 - uImage is corrupted.
|
||
|
|
+ * 1 - image is not a uImage.
|
||
|
|
+ */
|
||
|
|
+ if (!ret)
|
||
|
|
+ return 0;
|
||
|
|
+ else
|
||
|
|
+ return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
int uImage_arm64_load(int argc, char **argv, const char *buf, off_t len,
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|