From patchwork Thu Dec 31 01:34:24 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: 41957 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 C91671007D1 for ; Thu, 31 Dec 2009 12:53:13 +1100 (EST) Received: from localhost ([127.0.0.1]:52211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQADt-0004Zk-Dk for incoming@patchwork.ozlabs.org; Wed, 30 Dec 2009 20:53:09 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQ9w4-0006Qz-1U for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQ9vy-0006Mn-OH for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:42 -0500 Received: from [199.232.76.173] (port=40634 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQ9vy-0006MV-J8 for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:38 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:33611) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQ9vx-00038j-TT for qemu-devel@nongnu.org; Wed, 30 Dec 2009 20:34:38 -0500 Received: by mail-fx0-f222.google.com with SMTP id 22so15607708fxm.2 for ; Wed, 30 Dec 2009 17:34:37 -0800 (PST) Received: by 10.223.5.8 with SMTP id 8mr13313268fat.48.1262223277339; Wed, 30 Dec 2009 17:34:37 -0800 (PST) Received: from localhost.localdomain (a88-114-220-92.elisa-laajakaista.fi [88.114.220.92]) by mx.google.com with ESMTPS id z10sm20643205fka.30.2009.12.30.17.34.35 (version=SSLv3 cipher=RC4-MD5); Wed, 30 Dec 2009 17:34:36 -0800 (PST) From: "Kirill A. Shutemov" To: qemu-devel@nongnu.org Date: Thu, 31 Dec 2009 03:34:24 +0200 Message-Id: <1262223266-19191-3-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1262223266-19191-2-git-send-email-kirill@shutemov.name> References: <1262223266-19191-1-git-send-email-kirill@shutemov.name> <1262223266-19191-2-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/14] 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 --- 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..e496c64 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 -errno; /* 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) + return -errno; if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); if (ret != 0) {