From patchwork Sat Mar 4 18:55:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 9604221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 67B9660414 for ; Sat, 4 Mar 2017 18:56:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 602242839C for ; Sat, 4 Mar 2017 18:56:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 536682844C; Sat, 4 Mar 2017 18:56:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD9FA2839C for ; Sat, 4 Mar 2017 18:56:51 +0000 (UTC) Received: from localhost ([::1]:36284 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckErK-00060w-Vh for patchwork-qemu-devel@patchwork.kernel.org; Sat, 04 Mar 2017 13:56:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckEr3-0005yp-Pt for qemu-devel@nongnu.org; Sat, 04 Mar 2017 13:56:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckEr3-0007eS-10 for qemu-devel@nongnu.org; Sat, 04 Mar 2017 13:56:33 -0500 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:32918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ckEr2-0007eE-T4 for qemu-devel@nongnu.org; Sat, 04 Mar 2017 13:56:32 -0500 Received: by mail-qk0-x242.google.com with SMTP id j127so16933004qke.0 for ; Sat, 04 Mar 2017 10:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=quEwaLWvptynyQXKirHCz0ViEa00Yg7/RL0vmC8SBXU=; b=V7eW+rfmNJ/3kao1FZqGi1jIG8aDLIxE19izYdrqWPEt2m16GVhI8EasQ53Pc0+Wy+ kI0Z9Eb6HP8sNCSVdeMJ3FB9spuMhAeqtpD5YSp173h0QrjuItgbU/LbhrgPopJQucfo N6ewYcAfpTKYwHXrBBD6kcMHOI4SNphIjDJEDTACo6yHAu80Agn5LdcN+t8I1kZg0tAU oRRBBuyYuhXkrzKOndjQ+8t47giF5pCGAXRubEnTs9Q50MvYy5tVDPxHAn9lqyweosrr kBz+SN/P9RahjO4RiVY55AVkp9TVV3pKJYLSCXeGZOYs2TtZ6O4760lnBG9sMGyTwqk7 9xZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=quEwaLWvptynyQXKirHCz0ViEa00Yg7/RL0vmC8SBXU=; b=HKQsZZM+DCMCzydXZW8QEnfkggUCV1shdMGjmaFgmXFG73aIscryYnr9IOhgK9Pf6D NCaQ0SbPqTJummNxvJgFUeJjZKxDbeWmCp2EIMZlQRhNmLpFmWEh65LMwZrFmSOUUg+v FDFPiviJSAGOwbqs0z7pA8axC58xoMW96PT6UO9vuJJlHg6dk5y8Uat11KLAUIHGlLK3 Vux5WlAbUzlbcxF5ZNc1pF2ngAspmADLrSnMZykKcCoO2pfJegBWbvuGrRDfCaIeHPu7 W7tgAR+8UbqwWtbfx8QB8J6H2u1nCgRbUClXyngxLnASew+atqo0dqP2J7uRJDOs8xGH Ja/A== X-Gm-Message-State: AMke39kQJlM4UF7c+iKaquBpYWkdpgE3ZuaYk+f6jF87EoWjIOe4AATU17hNF8Q54h8pYw== X-Received: by 10.55.138.129 with SMTP id m123mr2526049qkd.109.1488653792393; Sat, 04 Mar 2017 10:56:32 -0800 (PST) Received: from yoga.lan ([138.117.48.226]) by smtp.gmail.com with ESMTPSA id o14sm10065138qtc.46.2017.03.04.10.56.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Mar 2017 10:56:31 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Michael Roth , Peter Crosthwaite , Alexander Graf , Gerd Hoffmann Date: Sat, 4 Mar 2017 15:55:33 -0300 Message-Id: <20170304185533.10618-4-f4bug@amsat.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170304185533.10618-1-f4bug@amsat.org> References: <20170304185533.10618-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::242 Subject: [Qemu-devel] [PATCH 3/3] qga: fix compiler warnings (clang 5) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é Reviewed-by: Marc-André Lureau --- 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);