From patchwork Sun Dec 20 01:39:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 41502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 58494B6F09 for ; Sun, 20 Dec 2009 13:04:56 +1100 (EST) Received: from localhost ([127.0.0.1]:60366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMBAD-0002QK-7O for incoming@patchwork.ozlabs.org; Sat, 19 Dec 2009 21:04:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NMAmE-00089u-LA for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NMAm7-00084P-Pg for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:40:03 -0500 Received: from [199.232.76.173] (port=54484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMAm7-000843-4I for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:39:59 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:56134) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NMAm6-0004ms-F4 for qemu-devel@nongnu.org; Sat, 19 Dec 2009 20:39:58 -0500 Received: by mail-fx0-f222.google.com with SMTP id 22so4042062fxm.2 for ; Sat, 19 Dec 2009 17:39:58 -0800 (PST) Received: by 10.223.27.79 with SMTP id h15mr939048fac.23.1261273198081; Sat, 19 Dec 2009 17:39:58 -0800 (PST) Received: from localhost.localdomain (a88-114-220-92.elisa-laajakaista.fi [88.114.220.92]) by mx.google.com with ESMTPS id 13sm6982256fks.45.2009.12.19.17.39.56 (version=SSLv3 cipher=RC4-MD5); Sat, 19 Dec 2009 17:39:57 -0800 (PST) From: "Kirill A. Shutemov" To: qemu-devel@nongnu.org Date: Sun, 20 Dec 2009 03:39:25 +0200 Message-Id: <1261273167-3240-16-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.6.5.6 In-Reply-To: <1261273167-3240-15-git-send-email-kirill@shutemov.name> References: <1261273167-3240-1-git-send-email-kirill@shutemov.name> <1261273167-3240-2-git-send-email-kirill@shutemov.name> <1261273167-3240-3-git-send-email-kirill@shutemov.name> <1261273167-3240-4-git-send-email-kirill@shutemov.name> <1261273167-3240-5-git-send-email-kirill@shutemov.name> <1261273167-3240-6-git-send-email-kirill@shutemov.name> <1261273167-3240-7-git-send-email-kirill@shutemov.name> <1261273167-3240-8-git-send-email-kirill@shutemov.name> <1261273167-3240-9-git-send-email-kirill@shutemov.name> <1261273167-3240-10-git-send-email-kirill@shutemov.name> <1261273167-3240-11-git-send-email-kirill@shutemov.name> <1261273167-3240-12-git-send-email-kirill@shutemov.name> <1261273167-3240-13-git-send-email-kirill@shutemov.name> <1261273167-3240-14-git-send-email-kirill@shutemov.name> <1261273167-3240-15-git-send-email-kirill@shutemov.name> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: "Kirill A. Shutemov" Subject: [Qemu-devel] [PATCH 16/18] hw/pc.c: fix warnings with _FORTIFY_SOURCE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org CC i386-softmmu/pc.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_multiboot': /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:614: error: ignoring return value of 'fread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c: In function 'load_linux': /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:888: error: ignoring return value of 'fread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/hw/pc.c:889: error: ignoring return value of 'fread', declared with attribute warn_unused_result make[1]: *** [pc.o] Error 1 Signed-off-by: Kirill A. Shutemov --- hw/pc.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index db7d58e..83f8dd0 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -613,7 +613,10 @@ static int load_multiboot(void *fw_cfg, mb_kernel_data = qemu_malloc(mb_kernel_size); fseek(f, mb_kernel_text_offset, SEEK_SET); - fread(mb_kernel_data, 1, mb_kernel_size, f); + if (fread(mb_kernel_data, 1, mb_kernel_size, f) != mb_kernel_size) { + fprintf(stderr, "fread() failed\n"); + exit(1); + } fclose(f); } @@ -887,8 +890,14 @@ static void load_linux(void *fw_cfg, setup = qemu_malloc(setup_size); kernel = qemu_malloc(kernel_size); fseek(f, 0, SEEK_SET); - fread(setup, 1, setup_size, f); - fread(kernel, 1, kernel_size, f); + if (fread(setup, 1, setup_size, f) != setup_size) { + fprintf(stderr, "fread() failed\n"); + exit(1); + } + if (fread(kernel, 1, kernel_size, f) != kernel_size) { + fprintf(stderr, "fread() failed\n"); + exit(1); + } fclose(f); memcpy(setup, header, MIN(sizeof(header), setup_size));