From nobody Mon May 6 13:24:10 2024 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; 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 1505457442340978.2640042016718; Thu, 14 Sep 2017 23:37:22 -0700 (PDT) Received: from localhost ([::1]:51565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dskFd-000148-Lg for importer@patchew.org; Fri, 15 Sep 2017 02:37:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dskEq-0000eD-EB for qemu-devel@nongnu.org; Fri, 15 Sep 2017 02:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dskEm-0007n3-Bt for qemu-devel@nongnu.org; Fri, 15 Sep 2017 02:36:32 -0400 Received: from ozlabs.ru ([107.173.13.209]:60448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dskEm-0007ma-5y for qemu-devel@nongnu.org; Fri, 15 Sep 2017 02:36:28 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 644F63A6000A; Fri, 15 Sep 2017 02:37:09 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Fri, 15 Sep 2017 16:35:52 +1000 Message-Id: <20170915063552.33868-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu v2] pci: Initialize pci_dev->name before use 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: Alexey Kardashevskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Changes: v2: * fixed mistype in the commit log * added "rb" --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 21e203b056..353195d154 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *p= ci_dev, PCIBus *bus, =20 pci_dev->devfn =3D devfn; pci_dev->requester_id_cache =3D pci_req_id_cache_get(pci_dev); + pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); =20 memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_d= ev), "bus master container", UINT64_MAX); @@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *p= ci_dev, PCIBus *bus, if (qdev_hotplug) { pci_init_bus_master(pci_dev); } - pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state =3D 0; pci_config_alloc(pci_dev); =20 --=20 2.11.0