lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinLHji_PKZ5pRHVHdsVdiX0N3=NJxDHsORNS4T5@mail.gmail.com>
Date:	Tue, 1 Mar 2011 09:52:28 +0800
From:	Daniel J Blueman <daniel.blueman@...il.com>
To:	Américo Wang <xiyou.wangcong@...il.com>
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>, x86@...nel.org
Subject: Re: [2.6.38-rc6] build:mkpiggy fixlet...

On 1 March 2011 00:25, Américo Wang <xiyou.wangcong@...il.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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ