From nobody Wed Nov 5 16:36:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496682685638784.7296962573076; Mon, 5 Jun 2017 10:11:25 -0700 (PDT) Received: from localhost ([::1]:34441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHvXH-0005fU-55 for importer@patchew.org; Mon, 05 Jun 2017 13:11:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHvNx-0005rV-Af for qemu-devel@nongnu.org; Mon, 05 Jun 2017 13:01:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHvNw-00017O-Kk for qemu-devel@nongnu.org; Mon, 05 Jun 2017 13:01:45 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37211) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHvNw-00014x-EF; Mon, 05 Jun 2017 13:01:44 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dHvNr-00030A-Ep; Mon, 05 Jun 2017 18:01:39 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 5 Jun 2017 18:01:38 +0100 Message-Id: <1496682098-1540-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] 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: Kevin Wolf , Jeff Cody , Max Reitz , qemu-block@nongnu.org, patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- block/gluster.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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(BlockdevOptionsGlust= er *gconf, Error *local_err =3D NULL; char *str =3D NULL; const char *ptr; - size_t num_servers; - int i, type; + int i, type, num_servers; =20 /* create opts info from runtime_json_opts list */ opts =3D qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); --=20 2.7.4