From: Bhupesh Sharma <bhsharma@redhat.com>
To: kexec@lists.infradead.org
Cc: bhupesh.linux@gmail.com, bhsharma@redhat.com, horms@verge.net.au,
takahiro.akashi@linaro.org
Subject: [PATCH 2/4] kexec-uImage-arm64.c: Fix return value of uImage_arm64_probe()
Date: Thu, 11 Jul 2019 01:24:27 +0530 [thread overview]
Message-ID: <1562788469-22935-3-git-send-email-bhsharma@redhat.com> (raw)
In-Reply-To: <1562788469-22935-1-git-send-email-bhsharma@redhat.com>
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>
---
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 126ea9c2555b..c4669131b667 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,
--
2.7.4
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2019-07-10 19:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 19:54 [PATCH 0/4] kexec/arm64: Add support for zlib compressed kernel images (Image.gz) Bhupesh Sharma
2019-07-10 19:54 ` [PATCH 1/4] kexec/kexec.c: Add the missing close() for fd used for kexec_file_load() Bhupesh Sharma
2019-07-10 19:54 ` Bhupesh Sharma [this message]
2019-07-10 19:54 ` [PATCH 3/4] kexec/kexec-zlib.h: Add 'is_zlib_file()' helper function Bhupesh Sharma
2019-07-11 9:58 ` Simon Horman
2019-07-12 8:06 ` Bhupesh Sharma
2019-07-10 19:54 ` [PATCH 4/4] kexec/arm64: Add support for handling zlib compressed (Image.gz) image Bhupesh Sharma
2019-07-11 10:08 ` Simon Horman
2019-07-12 8:06 ` Bhupesh Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1562788469-22935-3-git-send-email-bhsharma@redhat.com \
--to=bhsharma@redhat.com \
--cc=bhupesh.linux@gmail.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.org \
--cc=takahiro.akashi@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox