From: Dave Young <dyoung@redhat.com>
To: horms@verge.net.au
Cc: kexec@lists.infradead.org
Subject: [PATCH 1/2] zImage_ppc64_probe: return 0 instead of 1 in case of success
Date: Thu, 6 Feb 2014 14:30:43 +0800 [thread overview]
Message-ID: <1391668244-13631-2-git-send-email-dyoung@redhat.com> (raw)
In-Reply-To: <1391668244-13631-1-git-send-email-dyoung@redhat.com>
All other _probe functions return 0 for probing the kernel
image successfully, so there's no reason to return 1 here.
Fix it to return 0 instead.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
kexec/arch/ppc64/kexec-zImage-ppc64.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kexec/arch/ppc64/kexec-zImage-ppc64.c b/kexec/arch/ppc64/kexec-zImage-ppc64.c
index 24a87c6..d084ee5 100644
--- a/kexec/arch/ppc64/kexec-zImage-ppc64.c
+++ b/kexec/arch/ppc64/kexec-zImage-ppc64.c
@@ -36,6 +36,7 @@
int zImage_ppc64_probe(FILE *file)
{
Elf32_Ehdr elf;
+ int valid;
if (fseek(file, 0, SEEK_SET) < 0) {
fprintf(stderr, "seek error: %s\n",
@@ -53,7 +54,7 @@ int zImage_ppc64_probe(FILE *file)
return -1;
}
- return (elf.e_ident[EI_MAG0] == ELFMAG0 &&
+ valid = (elf.e_ident[EI_MAG0] == ELFMAG0 &&
elf.e_ident[EI_MAG1] == ELFMAG1 &&
elf.e_ident[EI_MAG2] == ELFMAG2 &&
elf.e_ident[EI_MAG3] == ELFMAG3 &&
@@ -61,6 +62,8 @@ int zImage_ppc64_probe(FILE *file)
elf.e_ident[EI_DATA] == ELFDATA2MSB &&
elf.e_type == ET_EXEC &&
elf.e_machine == EM_PPC);
+
+ return valid ? 0 : -1;
}
int zImage_ppc64_load(FILE *file, int UNUSED(argc), char **UNUSED(argv),
--
1.8.3.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2014-02-06 6:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-06 6:30 [PATCH 0/2] kernel probe function fixes Dave Young
2014-02-06 6:30 ` Dave Young [this message]
2014-02-06 7:30 ` [PATCH 1/2] zImage_ppc64_probe: return 0 instead of 1 in case of success Simon Horman
2014-02-06 6:30 ` [PATCH 2/2] kernel image probe function return value checking fix Dave Young
2014-02-06 7:30 ` Simon Horman
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=1391668244-13631-2-git-send-email-dyoung@redhat.com \
--to=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=kexec@lists.infradead.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