summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
authorDaniel J Blueman <daniel.blueman@gmail.com>2011-02-23 02:33:59 +0100
committerH. Peter Anvin <hpa@linux.intel.com>2011-03-02 01:32:03 +0100
commit6670e9cdaf554290e26121aa72f0118f2fac52e5 (patch)
treee7f4cd9b0a9724241c68a6fbf7a25e695429a6e8 /arch/x86/boot
parentLinux 2.6.38-rc7 (diff)
downloadlinux-6670e9cdaf554290e26121aa72f0118f2fac52e5.tar.xz
linux-6670e9cdaf554290e26121aa72f0118f2fac52e5.zip
x86, build: Make sure mkpiggy fails on read error
Ensure build doesn't silently continue despite read failure, addressing a warning due to the unchecked call. Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com> LKML-Reference: <AANLkTimxxTMU3=4ry-_zbY6v1xiDi+hW9y1RegTr8vLK@mail.gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/compressed/mkpiggy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 646aa78ba5fd..46a823882437 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -62,7 +62,12 @@ int main(int argc, char *argv[])
if (fseek(f, -4L, SEEK_END)) {
perror(argv[1]);
}
- fread(&olen, sizeof olen, 1, f);
+
+ if (fread(&olen, sizeof(olen), 1, f) != 1) {
+ perror(argv[1]);
+ return 1;
+ }
+
ilen = ftell(f);
olen = getle32(&olen);
fclose(f);