From nobody Thu Nov 6 12:14:38 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.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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 154095107699896.2979511176544; Tue, 30 Oct 2018 18:57:56 -0700 (PDT) Received: from localhost ([::1]:56673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHflV-0000jk-IR for importer@patchew.org; Tue, 30 Oct 2018 21:57:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHfVQ-000105-UP for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHfVM-0002e2-Ih for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:12 -0400 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]:35189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHfVM-0002dD-D9 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 21:41:08 -0400 Received: by mail-qk1-x744.google.com with SMTP id v68-v6so8592100qka.2 for ; Tue, 30 Oct 2018 18:41:08 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id v23-v6sm19088010qtv.65.2018.10.30.18.41.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 18:41:05 -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 :mime-version:content-transfer-encoding; bh=OMsafrgRN8K7qYrDHmXKNcug1Hah0nOGn2aWbm0aBsM=; b=ZGqLNlOfJBjZ4DCPUZz7TLnowtBzZ7U+k3/B44pfwgFYzJHDCcZLOG4j3gUyoJfNcL EzUuTOcqJZ2Q81Yaz3NeDqthroSvvYsZl8gP/bdY5ILGGCnA89FtHzXdLBpEVmyutmjy YxyC0nanIEv38yeB1A/J461yEQ641mblwU+4m5R1x9UAes1Try1Gx/NnGwH1LC56Lhx5 wNqr2/4DyBn+P09HxCWeVur/PT76RCxa12h+1wDljIjDj3rSAdfR7vGujzdSGS6ImVP5 XUQ5gv5Y1ZQ9Wz+NQj02nemTMu1/kHOXdG1VvK5j1LTOAo5Uq9Xg46lkaBKAexmVLHdF 8ynQ== 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=OMsafrgRN8K7qYrDHmXKNcug1Hah0nOGn2aWbm0aBsM=; b=NZcybLlCHpCa4Ud366tOGKFkDYNr1tlD+ob3U8aB0VUTkGbTDbYKhWIpRbv/SWxwf9 JlC0dhAdQwPn/lpaeR3E00Js2eE3cBezQzCSN9VEzMEXSfAPMcaFtfvROISqssU/2PvY Bgfuq8O9wR0nTIhIVoLUUBJrYHYwHc+5SWTjHDnkVtCzvCDHyY0F4mIUZ/ERQwEYVgcZ duGlhUgMV88wTPF4MjwJVxfcUXup9VwBU+gcRiil3ET2Dg/cclONZc6Q95v6TvXXMaSS Q1ZT7ggud2hfNnNHupJ8A0rkbgKOynYCA8V3tIG/1WFn7bDWbGaiXS6x3z34Whkznyik tPuQ== X-Gm-Message-State: AGRZ1gJNidqb2DylPSH31GN9fIDdrpaT0iXTOekLQjs8dibbI3+jlRss qtcS1IJFDkhnBZHnHOxnQRHnYNkO X-Google-Smtp-Source: AJdET5eT4sQRTn9qNTBwo2COeMrmgUylzcCFFWw60CqGKHZRSliksaSQPbI22pfFdgvMqDeVZM9Frg== X-Received: by 2002:a37:8d:: with SMTP id t13mr888070qkg.93.1540950066985; Tue, 30 Oct 2018 18:41:06 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 20:38:04 -0500 Message-Id: <20181031013821.24023-8-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> References: <20181031013821.24023-1-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::744 Subject: [Qemu-devel] [PULL v2 07/24] qga-win: prevent crash when executing fsinfo command 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: Sameeh Jubran , peter.maydell@linaro.org, =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Sameeh Jubran The fsinfo command is currently implemented for Windows only and it's disk parameter can be enabled by adding the define "CONFIG_QGA_NTDDSCSI" to the = qga code. When enabled and executed the qemu-ga crashed with the following mess= age: Reviewed-by: Philippe Mathieu-Daud=C3=A9 ------------------------------------------------ File qapi/qapi-visit-core.c, Line 49 Expression: !(v->type & VISITOR_OUTPUT) || *obj) ------------------------------------------------ After some digging, turns out that the GuestPCIAddress is null and the qapi visitor doesn't like that, so we can always allocate it instead and initiate all it's members to -1. Signed-off-by: Sameeh Jubran Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Michael Roth Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD Signed-off-by: Michael Roth --- qga/commands-win32.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 347577f2a4..f0e6f6128b 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -499,6 +499,11 @@ static GuestPCIAddress *get_pci_info(char *guid, Error= **errp) char *buffer =3D NULL; GuestPCIAddress *pci =3D NULL; char *name =3D g_strdup(&guid[4]); + pci =3D g_malloc0(sizeof(*pci)); + pci->domain =3D -1; + pci->slot =3D -1; + pci->function =3D -1; + pci->bus =3D -1; =20 if (!QueryDosDevice(name, dev_name, ARRAY_SIZE(dev_name))) { error_setg_win32(errp, GetLastError(), "failed to get dos device n= ame"); @@ -570,7 +575,6 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) =20 func =3D addr & 0x0000FFFF; dev =3D (addr >> 16) & 0x0000FFFF; - pci =3D g_malloc0(sizeof(*pci)); pci->domain =3D dev; pci->slot =3D slot; pci->function =3D func; --=20 2.17.1