From patchwork Sat Jan 2 03:45:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 42002 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 D9ABCB6EED for ; Sat, 2 Jan 2010 15:03:54 +1100 (EST) Received: from localhost ([127.0.0.1]:44193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQvDT-0004oF-Un for incoming@patchwork.ozlabs.org; Fri, 01 Jan 2010 23:03:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQuwE-0006dH-0V for qemu-devel@nongnu.org; Fri, 01 Jan 2010 22:46:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQuw8-0006Zy-7q for qemu-devel@nongnu.org; Fri, 01 Jan 2010 22:46:00 -0500 Received: from [199.232.76.173] (port=53817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQuw7-0006Zu-SD for qemu-devel@nongnu.org; Fri, 01 Jan 2010 22:45:55 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:63383) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQuw7-00082k-KE for qemu-devel@nongnu.org; Fri, 01 Jan 2010 22:45:55 -0500 Received: by mail-fx0-f222.google.com with SMTP id 22so16659819fxm.2 for ; Fri, 01 Jan 2010 19:45:55 -0800 (PST) Received: by 10.223.5.25 with SMTP id 25mr5527854fat.38.1262403955128; Fri, 01 Jan 2010 19:45:55 -0800 (PST) Received: from localhost.localdomain (a88-114-220-92.elisa-laajakaista.fi [88.114.220.92]) by mx.google.com with ESMTPS id 35sm22820386fkt.40.2010.01.01.19.45.53 (version=SSLv3 cipher=RC4-MD5); Fri, 01 Jan 2010 19:45:54 -0800 (PST) From: "Kirill A. Shutemov" To: qemu-devel@nongnu.org Date: Sat, 2 Jan 2010 05:45:30 +0200 Message-Id: <1262403933-26881-12-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1262403933-26881-11-git-send-email-kirill@shutemov.name> References: <1262403933-26881-1-git-send-email-kirill@shutemov.name> <1262403933-26881-2-git-send-email-kirill@shutemov.name> <1262403933-26881-3-git-send-email-kirill@shutemov.name> <1262403933-26881-4-git-send-email-kirill@shutemov.name> <1262403933-26881-5-git-send-email-kirill@shutemov.name> <1262403933-26881-6-git-send-email-kirill@shutemov.name> <1262403933-26881-7-git-send-email-kirill@shutemov.name> <1262403933-26881-8-git-send-email-kirill@shutemov.name> <1262403933-26881-9-git-send-email-kirill@shutemov.name> <1262403933-26881-10-git-send-email-kirill@shutemov.name> <1262403933-26881-11-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 12/15] 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 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 test --- 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) {