mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: Daniel J Blueman <daniel.blueman@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>, x86@kernel.org
Subject: Re: [2.6.38-rc6] build:mkpiggy fixlet...
Date: Tue, 1 Mar 2011 00:25:54 +0800	[thread overview]
Message-ID: <20110228162554.GE25998@cr0.redhat.com> (raw)
In-Reply-To: <AANLkTimxxTMU3=4ry-_zbY6v1xiDi+hW9y1RegTr8vLK@mail.gmail.com>

On Wed, Feb 23, 2011 at 09:33:59AM +0800, Daniel J Blueman wrote:
>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>
>
>diff --git a/arch/x86/boot/compressed/mkpiggy.c
>b/arch/x86/boot/compressed/mkpiggy.c
>index 646aa78..845a1f8 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;


You need to close the file here...


>+	}
>+		
> 	ilen = ftell(f);
> 	olen = getle32(&olen);
> 	fclose(f);

Thanks.

  reply	other threads:[~2011-02-28 16:26 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 ` Daniel J Blueman
2011-02-28 16:25   ` Américo Wang [this message]
2011-03-01  1:52     ` Daniel J Blueman
2011-03-02  0:43   ` [tip:x86/urgent] x86, build: Make sure mkpiggy fails on read error tip-bot for Daniel J Blueman

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=20110228162554.GE25998@cr0.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=daniel.blueman@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®