From: Daniel J Blueman Date: Wed, 23 Feb 2011 01:33:59 +0000 (+0800) Subject: x86, build: Make sure mkpiggy fails on read error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6670e9cdaf554290e26121aa72f0118f2fac52e5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 LKML-Reference: Signed-off-by: H. Peter Anvin --- 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);