qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Michael Roth <mdroth@linux.vnet.ibm.com>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	Alexander Graf <agraf@suse.de>, Gerd Hoffmann <kraxel@redhat.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] qga: fix compiler warnings (clang 5)
Date: Sat,  4 Mar 2017 15:55:33 -0300	[thread overview]
Message-ID: <20170304185533.10618-4-f4bug@amsat.org> (raw)
In-Reply-To: <20170304185533.10618-1-f4bug@amsat.org>

static code analyzer complain:

qga/commands-posix.c:2127:9: warning: Null pointer passed as an argument to a 'nonnull' parameter
        closedir(dp);
        ^~~~~~~~~~~~

Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 qga/commands-posix.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index ea37c097cf..9c4ef2d640 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2119,9 +2119,11 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk,
          * we think this VM does not support online/offline memory block,
          * any other solution?
          */
-        if (!dp && errno == ENOENT) {
-            result->response =
-                GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED;
+        if (!dp) {
+            if (errno == ENOENT) {
+                result->response =
+                    GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED;
+            }
             goto out1;
         }
         closedir(dp);
-- 
2.11.0

  parent reply	other threads:[~2017-03-04 18:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 18:55 [Qemu-devel] [PATCH 0/3] easy-to-fix clang warnings Philippe Mathieu-Daudé
2017-03-04 18:55 ` [Qemu-devel] [PATCH 1/3] usb-ccid: make ccid_write_data_block() cope with null buffers Philippe Mathieu-Daudé
2017-03-05 21:01   ` Marc-André Lureau
2017-03-04 18:55 ` [Qemu-devel] [PATCH 2/3] device_tree: fix compiler warnings (clang 5) Philippe Mathieu-Daudé
2017-03-04 18:55 ` Philippe Mathieu-Daudé [this message]
2017-03-05 20:59   ` [Qemu-devel] [PATCH 3/3] qga: " Marc-André Lureau
2017-03-05  7:52 ` [Qemu-devel] [PATCH 0/3] easy-to-fix clang warnings Markus Armbruster

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=20170304185533.10618-4-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=agraf@suse.de \
    --cc=crosthwaite.peter@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@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).