From nobody Sun Feb 8 12:37:55 2026 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.zohomail.com; dkim=fail; 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532379695487285.3608616593714; Mon, 23 Jul 2018 14:01:35 -0700 (PDT) Received: from localhost ([::1]:36597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhxR-0004Hu-B9 for importer@patchew.org; Mon, 23 Jul 2018 17:01:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhJn-00030e-El for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhJm-0004la-Ks for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:20:31 -0400 Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]:39354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhJm-0004lE-FR; Mon, 23 Jul 2018 16:20:30 -0400 Received: by mail-oi0-x230.google.com with SMTP id d189-v6so3482968oib.6; Mon, 23 Jul 2018 13:20:30 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id n6-v6sm9331253oib.27.2018.07.23.13.20.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:20:28 -0700 (PDT) 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; bh=mHJgjdp2Vil9qIKDIe2fzj/mFOiua4IISQrnc8448ik=; b=tK5AZkpTZEHgKcLtAvwbV91f+Csb3vTf9Om5UkYq3X1r3UonAMUrtqA6CCbzlQTUs/ ymBluLpEAarr58Yavn8zg+3/HFJkpy8X30ALabOr+eCGwYhIyAZh6tjtzIv24oFnMAPq +vfiXONj8SgfkKTip5nLaROYhbtl3LRBrxsGwIx+yysQWoL5Xok59E0Srchtp6eqQFWW 6LePfb9s3ChoPAxjtU01v9J6tQ/Cov23dOlnA+eMj9tkWQmsKKI/ZwP7wUVwqekIICSJ FR7VhSjq4yTAHj/0ytlLwzgZa5J8sji6f7TjklV954WbtaAXzM81Ee0PD3LUQLvniOr2 1fJQ== 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; bh=mHJgjdp2Vil9qIKDIe2fzj/mFOiua4IISQrnc8448ik=; b=OLUN8jAfM4YafuTpp1+VFgR2SiO3IDZzmGSSZ11TH7c6aWzRIjIuFuxacbhLL5zN4B i4/Orr3hzDb2lVGNG2q7Lk7Q7YDSKkPYZnbpUAfxCH37lOjIYx04wOWpphhvOvA3NrVE 67LHd0JnqsP0y6U5VFVxNNFWLhhFLPxi9UVm7+xzGNh1lQMTOppNQ+7Zmgon5DPX4VF3 iakQIqtUK7hL4TcY6hn/r5QLThFuQ9R7neyTOh8a1Xu5ctyFdhppuJuxdyr1cm4kXF6S /2k0urJ0wMAFqhdaRrpKejYDqw9LCQgkSXYzMiur9rbRxOXVhLOhzMBGOhmaJZf/Tbp4 wi7g== X-Gm-Message-State: AOUpUlFQz8aAsiF/b0ClpLoisJw1psfZ9h+z8WP3LuXRi2c0K1SQb6Gc gViEpTaT2izPTzM9rrEZ0O4Cur4+qsg= X-Google-Smtp-Source: AAOMgpcwKMEcR+xS5v2MtoAMupZvG/5IJ1OStAEMeOUnU6a0SPq0a7OVf2h71t2MohEFZftTXqo7jA== X-Received: by 2002:aca:abc6:: with SMTP id u189-v6mr304207oie.61.1532377229352; Mon, 23 Jul 2018 13:20:29 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:04 -0500 Message-Id: <20180723201748.25573-56-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::230 Subject: [Qemu-devel] [PATCH 55/99] nbd/client: fix nbd_negotiate_simple_meta_context 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: Vladimir Sementsov-Ogievskiy , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Vladimir Sementsov-Ogievskiy Initialize received variable. Otherwise, is is possible for server to answer without any contexts, but we will set context_id to something random (received_id is not initialized too) and return 1, which is wrong. To solve it, just initialize received to false. Initialize received_id too, just to make all possible checkers happy. Bug was introduced in 78a33ab58782efdb206de14 "nbd: BLOCK_STATUS for standard get_block_status function: client part" with the whole function. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20180427142002.21930-2-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake (cherry picked from commit 89aa0d87634e2cb98517509dc8bdb876f26ecf8b) Signed-off-by: Michael Roth --- nbd/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbd/client.c b/nbd/client.c index 3523c863fe..232ff4f46d 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -619,8 +619,8 @@ static int nbd_negotiate_simple_meta_context(QIOChannel= *ioc, { int ret; NBDOptionReply reply; - uint32_t received_id; - bool received; + uint32_t received_id =3D 0; + bool received =3D false; uint32_t export_len =3D strlen(export); uint32_t context_len =3D strlen(context); uint32_t data_len =3D sizeof(export_len) + export_len + --=20 2.17.1