Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932084Ab1CBAnY (ORCPT ); Tue, 1 Mar 2011 19:43:24 -0500 Received: from hera.kernel.org ([140.211.167.34]:56946 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756553Ab1CBAnX (ORCPT ); Tue, 1 Mar 2011 19:43:23 -0500 Date: Wed, 2 Mar 2011 00:43:04 GMT From: tip-bot for Daniel J Blueman Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com, daniel.blueman@gmail.com, tglx@linutronix.de, hpa@linux.intel.com Reply-To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, daniel.blueman@gmail.com, tglx@linutronix.de, hpa@linux.intel.com In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86, build: Make sure mkpiggy fails on read error Message-ID: Git-Commit-ID: 6670e9cdaf554290e26121aa72f0118f2fac52e5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (hera.kernel.org [127.0.0.1]); Wed, 02 Mar 2011 00:43:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1513 Lines: 42 Commit-ID: 6670e9cdaf554290e26121aa72f0118f2fac52e5 Gitweb: http://git.kernel.org/tip/6670e9cdaf554290e26121aa72f0118f2fac52e5 Author: Daniel J Blueman AuthorDate: Wed, 23 Feb 2011 09:33:59 +0800 Committer: H. Peter Anvin 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 LKML-Reference: Signed-off-by: H. Peter Anvin --- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/