Skip to content

Commit

Permalink
x86, build: Make sure mkpiggy fails on read error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel J Blueman authored and H. Peter Anvin committed Mar 2, 2011
1 parent dd9c154 commit 6670e9c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/x86/boot/compressed/mkpiggy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6670e9c

Please sign in to comment.