mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Daniel J Blueman <daniel.blueman@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	daniel.blueman@gmail.com, tglx@linutronix.de,
	hpa@linux.intel.com
Subject: [tip:x86/urgent] x86, build: Make sure mkpiggy fails on read error
Date: Wed, 2 Mar 2011 00:43:04 GMT	[thread overview]
Message-ID: <tip-6670e9cdaf554290e26121aa72f0118f2fac52e5@git.kernel.org> (raw)
In-Reply-To: <AANLkTimxxTMU3=4ry-_zbY6v1xiDi+hW9y1RegTr8vLK@mail.gmail.com>

Commit-ID:  6670e9cdaf554290e26121aa72f0118f2fac52e5
Gitweb:     http://git.kernel.org/tip/6670e9cdaf554290e26121aa72f0118f2fac52e5
Author:     Daniel J Blueman <daniel.blueman@gmail.com>
AuthorDate: Wed, 23 Feb 2011 09:33:59 +0800
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Tue, 1 Mar 2011 16:32:03 -0800

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>
---
 arch/x86/boot/compressed/mkpiggy.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 646aa78..46a8238 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);

      parent reply	other threads:[~2011-03-02  0:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTimp0bywKCoqdc8=dZdGmRoOQZoySvjFRLsrk0np@mail.gmail.com>
2011-02-23  1:33 ` [2.6.38-rc6] build:mkpiggy fixlet Daniel J Blueman
2011-02-28 16:25   ` Américo Wang
2011-03-01  1:52     ` Daniel J Blueman
2011-03-02  0:43   ` tip-bot for Daniel J Blueman [this message]

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=tip-6670e9cdaf554290e26121aa72f0118f2fac52e5@git.kernel.org \
    --to=daniel.blueman@gmail.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®