From patchwork Tue Jan 19 23:56:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 43253 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 04C7DB7CDB for ; Wed, 20 Jan 2010 11:26:27 +1100 (EST) Received: from localhost ([127.0.0.1]:41103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXOLa-00008H-O8 for incoming@patchwork.ozlabs.org; Tue, 19 Jan 2010 19:22:58 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXNwN-0005wp-Ja for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXNwJ-0005tJ-2J for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:54 -0500 Received: from [199.232.76.173] (port=59387 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXNwI-0005t1-KP for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48397) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXNwI-0005wq-0C for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:50 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNunhf015656 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Jan 2010 18:56:49 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNuT3u027975; Tue, 19 Jan 2010 18:56:48 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 20 Jan 2010 00:56:20 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: kirill@shutemov.name Subject: [Qemu-devel] [PATCH 13/17] linux-user/mmap.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 From: Kirill A. Shutemov CC i386-linux-user/mmap.o cc1: warnings being treated as errors /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'mmap_frag': /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:253: error: ignoring return value of 'pread', declared with attribute warn_unused_result /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'target_mmap': /usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:477: error: ignoring return value of 'pread', declared with attribute warn_unused_result make[1]: *** [mmap.o] Error 1 Signed-off-by: Kirill A. Shutemov Signed-off-by: Juan Quintela --- linux-user/mmap.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 144fb7c..c1c7e48 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -250,7 +250,8 @@ static int mmap_frag(abi_ulong real_start, mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); /* read the corresponding file data */ - pread(fd, g2h(start), end - start, offset); + if (pread(fd, g2h(start), end - start, offset) == -1) + return -1; /* put final protection */ if (prot_new != (prot1 | PROT_WRITE)) @@ -474,7 +475,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, -1, 0); if (retaddr == -1) goto fail; - pread(fd, g2h(start), len, offset); + if (pread(fd, g2h(start), len, offset) == -1) + goto fail; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); if (ret != 0) {