From patchwork Fri Jun 9 12:43:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 103474 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp189706qgd; Fri, 9 Jun 2017 05:44:42 -0700 (PDT) X-Received: by 10.233.223.199 with SMTP id t190mr4149172qkf.247.1497012282502; Fri, 09 Jun 2017 05:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497012282; cv=none; d=google.com; s=arc-20160816; b=ENSBmV9z06cxG9R4lX40putg+L3C7C0PragrVrVcexQRz22XuoNL2cvyiwJcV2HU6d qihNgH7ihvnktdNijVL3ZbMBmav6hdyHJmZ8K8kdpvtv7qRiSacmGPQX28xEDgcwDzqO WDY+gasmquo7wieD3AU6wyeMSJlEQk7XNYFJzkvI6jVgzPQi2l+ir6x5xJnT3VT0Y2nA AsoyPvFwiULnxfeuweb8BC2y9XJoGa+eWazGe7DWlPZ3BbmxYkpXeJ+LSg1wjR5idMwe skPksewUFXyWTMfWNsR5+9k5XjAtmuagGMa50IYGGj2IEMZuPXCrbDqTcU992bzN7Iqc 7dRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-filter:dmarc-filter :arc-authentication-results; bh=nf4dFUK+wiLhTKdHzoTdUDzeR0n18CxMmf5QirHgVNQ=; b=SqI5K6k123Pxk0lgr5yyfBhgNR+XC1DDH4J/rIp51RLNH+50Asih2jqXIWH52xW1vO 20L7QutaqNHlAxe82ENEoZfl5A7qm7a13sEH9Zu5luH++03hEI+ae8dEP+VzJgTgeRHa BvXdVeXOCZyGUxyDVpotfZIcDF2wQvI9HXHpBHcZh9S9tkI4fkCeIMVk8jtzVQHGw9n5 yF8EPplrtTP1UOVER4LqqAN8AqBJuDTn8fNITxbfPmL/GpCKYYSR0kjdKAacVo/l53Gv HTOtf1IBFF1U8MBI6rlKnuP/PmaAxgiykLk4hfCZ0Ug8xj2Vz2soYLrF4gr+xJFXUXpM WiCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v43si904898qtc.253.2017.06.09.05.44.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 09 Jun 2017 05:44:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:54470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJJHM-0005Lw-10 for patch@linaro.org; Fri, 09 Jun 2017 08:44:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJJG7-0004YS-H1 for qemu-devel@nongnu.org; Fri, 09 Jun 2017 08:43:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJJG6-0003cr-N9 for qemu-devel@nongnu.org; Fri, 09 Jun 2017 08:43:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dJJG3-0003Xy-WA; Fri, 09 Jun 2017 08:43:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC9B1811A7; Fri, 9 Jun 2017 12:43:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC9B1811A7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jcody@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EC9B1811A7 Received: from localhost (ovpn-116-115.phx2.redhat.com [10.3.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 223E986321; Fri, 9 Jun 2017 12:43:17 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Fri, 9 Jun 2017 08:43:13 -0400 Message-Id: <20170609124313.8026-2-jcody@redhat.com> In-Reply-To: <20170609124313.8026-1-jcody@redhat.com> References: <20170609124313.8026-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 09 Jun 2017 12:43:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/1] block/gluster.c: Handle qdict_array_entries() failure 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: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell In qemu_gluster_parse_json(), the call to qdict_array_entries() could return a negative error code, which we were ignoring because we assigned the result to an unsigned variable. Fix this by using the 'int' type instead, which matches the return type of qdict_array_entries() and also the type we use for the loop enumeration variable 'i'. (Spotted by Coverity, CID 1360960.) Signed-off-by: Peter Maydell Reviewed-by: Eric Blake Reviewed-by: Jeff Cody Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Jeff Cody --- block/gluster.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.9.3 diff --git a/block/gluster.c b/block/gluster.c index 031596a..addceed 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -493,8 +493,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf, Error *local_err = NULL; char *str = NULL; const char *ptr; - size_t num_servers; - int i, type; + int i, type, num_servers; /* create opts info from runtime_json_opts list */ opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);