qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: aneesh.kumar@linux.vnet.ibm.com, agraf@suse.de
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] target-ppc: fix warn_unused_result build break with in-kernel HTAB support
Date: Wed, 12 Feb 2014 16:40:30 +0100	[thread overview]
Message-ID: <20140212154030.393.66279.stgit@bahia.local> (raw)
In-Reply-To: <20140210162515.07e11909@bahia.local>

The 7029677e4 commit introduced the following build break:

target-ppc/kvm.c: In function ‘kvmppc_hash64_write_pte’:
target-ppc/kvm.c:2017:10: error: ignoring return value of ‘write’, declared
with attribute warn_unused_result [-Werror=unused-result]
     write(htab_fd, &hpte_buf, sizeof(hpte_buf));
          ^

Even though nothing is done for the moment if kvm_htab_write() fails, we
obviously need to be explicit. Let's add an *empty* return path to please
gcc.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 target-ppc/kvm.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 2eaf956..343376c 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -2012,9 +2012,15 @@ void kvmppc_hash64_write_pte(CPUPPCState *env, target_ulong pte_index,
     hpte_buf.hpte[0] = pte0;
     hpte_buf.hpte[1] = pte1;
     /*
-     * Write the hpte entry
+     * Write the hpte entry.
+     * CAUTION: write() has the warn_unused_result attribute. Hence we
+     * need to check the return value, even though we do nothing.
      */
-    write(htab_fd, &hpte_buf, sizeof(hpte_buf));
+    if (write(htab_fd, &hpte_buf, sizeof(hpte_buf)) < 0) {
+        goto out_close;
+    }
+
+out_close:
     close(htab_fd);
     return;
 

  reply	other threads:[~2014-02-12 15:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  7:59 [Qemu-devel] [PATCH V9 0/5] target-ppc: Add support for dumping guest memory using qemu gdb server Aneesh Kumar K.V
2014-01-28  7:59 ` [Qemu-devel] [PATCH V9 1/5] target-ppc: Update external_htab even when HTAB is managed by kernel Aneesh Kumar K.V
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 2/5] target-ppc: Fix htab_mask calculation Aneesh Kumar K.V
2014-02-11 18:46   ` Aneesh Kumar K.V
2014-02-12 10:32     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-13  2:59   ` [Qemu-devel] [PATCH V10] " Aneesh Kumar K.V
2014-02-13 10:40     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-13 14:51       ` Alexander Graf
2014-02-14 13:06         ` Alexander Graf
2014-02-14 13:54           ` Alexander Graf
2014-02-14 14:28             ` Alexander Graf
2014-02-14 14:42               ` Alexander Graf
2014-02-15 11:02                 ` Greg Kurz
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 3/5] target-ppc: Fix page table lookup with kvm enabled Aneesh Kumar K.V
2014-02-10 16:27   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-12 15:24     ` [Qemu-devel] [PATCH] target-ppc: fix 32 bit build break in the page table lookup code Greg Kurz
2014-02-13  3:00       ` Aneesh Kumar K.V
2014-02-13 14:53         ` Alexander Graf
2014-02-13 16:54           ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-14  9:25             ` Alexander Graf
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 4/5] target-ppc: Change the hpte sore API Aneesh Kumar K.V
2014-01-28  8:00 ` [Qemu-devel] [PATCH V9 5/5] target-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab Aneesh Kumar K.V
2014-02-10 15:25   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-02-12 15:40     ` Greg Kurz [this message]
2014-02-13  3:00       ` [Qemu-devel] [PATCH] target-ppc: fix warn_unused_result build break with in-kernel HTAB support Aneesh Kumar K.V
2014-02-13 14:51         ` Alexander Graf
2014-02-06 14:58 ` [Qemu-devel] [PATCH V9 0/5] target-ppc: Add support for dumping guest memory using qemu gdb server Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140212154030.393.66279.stgit@bahia.local \
    --to=gkurz@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).