* [2.6.38-rc6] build:mkpiggy fixlet... [not found] <AANLkTimp0bywKCoqdc8=dZdGmRoOQZoySvjFRLsrk0np@mail.gmail.com> @ 2011-02-23 1:33 ` Daniel J Blueman 2011-02-28 16:25 ` Américo Wang 2011-03-02 0:43 ` [tip:x86/urgent] x86, build: Make sure mkpiggy fails on read error tip-bot for Daniel J Blueman 0 siblings, 2 replies; 4+ messages in thread From: Daniel J Blueman @ 2011-02-23 1:33 UTC (permalink / raw) To: Linux Kernel; +Cc: x86 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; + } + ilen = ftell(f); olen = getle32(&olen); fclose(f); -- Daniel J Blueman ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6.38-rc6] build:mkpiggy fixlet... 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:x86/urgent] x86, build: Make sure mkpiggy fails on read error tip-bot for Daniel J Blueman 1 sibling, 1 reply; 4+ messages in thread From: Américo Wang @ 2011-02-28 16:25 UTC (permalink / raw) To: Daniel J Blueman; +Cc: Linux Kernel, x86 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6.38-rc6] build:mkpiggy fixlet... 2011-02-28 16:25 ` Américo Wang @ 2011-03-01 1:52 ` Daniel J Blueman 0 siblings, 0 replies; 4+ messages in thread From: Daniel J Blueman @ 2011-03-01 1:52 UTC (permalink / raw) To: Américo Wang; +Cc: Linux Kernel, x86 On 1 March 2011 00:25, Américo Wang <xiyou.wangcong@gmail.com> wrote: > 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... I could close the file here to be polite, but since the program is exiting, the OS will close the file. I added the error path in a way consistent with the following error path - perhaps better than a more intrusive patch to handle everything gracefully; it just fixes the bug (ie silent failure) and isn't a cleanup. >>+ } >>+ >> ilen = ftell(f); >> olen = getle32(&olen); >> fclose(f); -- Daniel J Blueman ^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/urgent] x86, build: Make sure mkpiggy fails on read error 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-02 0:43 ` tip-bot for Daniel J Blueman 1 sibling, 0 replies; 4+ messages in thread From: tip-bot for Daniel J Blueman @ 2011-03-02 0:43 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, daniel.blueman, tglx, hpa 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); ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-02 0:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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:x86/urgent] x86, build: Make sure mkpiggy fails on read error tip-bot for Daniel J Blueman
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®