From nobody Thu Nov 6 12:13:09 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 1540911741990716.2687120479159; Tue, 30 Oct 2018 08:02:21 -0700 (PDT) Received: from localhost ([::1]:53742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHVX9-0007wa-GV for importer@patchew.org; Tue, 30 Oct 2018 11:02:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHVHI-0008W1-1d for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:45:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHVHC-0001gd-36 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:45:55 -0400 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]:37575) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHVHB-0001Fy-S3 for qemu-devel@nongnu.org; Tue, 30 Oct 2018 10:45:49 -0400 Received: by mail-qt1-x842.google.com with SMTP id d14-v6so13746559qto.4 for ; Tue, 30 Oct 2018 07:45: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 k18-v6sm18768963qtc.54.2018.10.30.07.45.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 07:45: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 :mime-version:content-transfer-encoding; bh=OMsafrgRN8K7qYrDHmXKNcug1Hah0nOGn2aWbm0aBsM=; b=G5wY9r5qRMM9ToqpAWp2z1+k/zRC+EoZCvbNPB7STxNb8m1mipgZmywaKqKCTvGDkU z4hi8RFvK+jLLKuevjyNl8UOcNjMjeIuZQ9VcGhpE0iwVpSGHNCGVq3E7+XbowcZSaee WEVxRJnE9L44koNXT18nwJRLwWii6R7t4e7HtNFqyoTOcdPMEb0+cUrs8DrtztrJu656 /urG4ht7nFzz9POQtCj31IolQZen1nwOm1C4X66fXgK645ro79efU1F4BPtOUvlDDj3v SPb4vHXquOfTk4d09xBNH5eChWuqAievMw3rz6S97BYwq51DoOIdzxRf9HyfVuCmbj4n +tCQ== 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=PDxxHOBxeXOFjyfUv5pScKZJeMsAlbgqTHt0kYevxVVR/9Ym4dYazeqFCwFtdcg1ZJ EEnqww9kGNBuVZGONyMsdDM4JXyCN+A1ZczGOzKoIyushK9KdFlG5aXbAbzxPWLgiAE4 gI+Mi6sAn/OF1EUzUdS907En+Sfbx1luCKB0cNvAEnu07UEYGH+fajMQqICMkxNkvBhT LQVFBwHzvDPzA3Ouxt0NyEc5XwgiXruIoyJBuiTd6O/cgFziH/FTtt3gcu3GcprLNdDo /0cVyhgwrv8FIBENmeaEN1BFFwxEqFeEt0OzYNIbAs3Wh/jhi6AXuBu+A7r1mXQ90p7s IccA== X-Gm-Message-State: AGRZ1gKbU3OHbYEljnsMefgBs1Cj0h/yFrXx2CSAiNVdLd0IOL6o64Bc yQHsiURHaDjivotyQ4+IzDR20jjt X-Google-Smtp-Source: AJdET5dKBCRG866jbi5/tbU9yVo8VU0UvKUl9mOMPiDAlkbRRg6oNphWhRFaZnKGgwEr+smhWqn7Dw== X-Received: by 2002:a0c:d810:: with SMTP id h16mr16805142qvj.19.1540910729325; Tue, 30 Oct 2018 07:45:29 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2018 09:43:41 -0500 Message-Id: <20181030144358.23144-8-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030144358.23144-1-mdroth@linux.vnet.ibm.com> References: <20181030144358.23144-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::842 Subject: [Qemu-devel] [PULL 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