From nobody Fri Nov 29 16:47:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1632474650; cv=none; d=zohomail.com; s=zohoarc; b=LPA5wXY9wKRdvFK3d16MYQk+uMU1EUGP9gf9ojW1bRX9emtHFSMDPKZMR4oZZZGHmQxz3AHA0kfUZx3Io2shT+26UTd7lrtW/vh2flCS+9TPuomrxiO9H/0tmTor63ePhF/SLt/Fqbb4qFTMBGctVQ2K1wGx3lvBhYwMI2Zr7gc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632474650; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=759rkBSYcJCDrfRtVP+TCyu8XiZa8Y0OILj4osxzYV8=; b=ZbBqnXvY7BJz0M0qMTsAA4P+RMloeGiGygoakCGCvxbw4h6R1Z6DTAyPRmdMGlldwz0OuXz5XLAwa+Sis+VrSslz6+5tnaAdPnwmM7p6tLhkSnHdMJhLyzu4FS5dEYS0S9/aWC7s4kJTUu14KgTIK73XteksNPnKryIA4U1C0ok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163247465096966.70275403588278; Fri, 24 Sep 2021 02:10:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.195045.347510 (Exim 4.92) (envelope-from ) id 1mThDz-00061r-F7; Fri, 24 Sep 2021 09:10:31 +0000 Received: by outflank-mailman (output) from mailman id 195045.347510; Fri, 24 Sep 2021 09:10:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mThDz-00061k-C0; Fri, 24 Sep 2021 09:10:31 +0000 Received: by outflank-mailman (input) for mailman id 195045; Fri, 24 Sep 2021 09:10:30 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mThDy-00061e-3i for xen-devel@lists.xenproject.org; Fri, 24 Sep 2021 09:10:30 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 42617344-1d17-11ec-bab1-12813bfff9fa; Fri, 24 Sep 2021 09:10:28 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 42617344-1d17-11ec-bab1-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1632474627; h=from:to:cc:subject:date:message-id:mime-version; bh=flt40ZSuy8Pfpgn6sTAAkDoqhWcDyGnzCI4H5hH2DIs=; b=Lg5JsFRbEJGWFH+pcvswaNIF/Jogzg4SNc2gFXYTzJyqhfJHd6uxeQby PERTPXOcwPakFqirinxpFy2WfeJXqsKD6oWsJGttGV+wX9ahcL6LZQ8ZC VShWdQJ0jy1guIzEFuWoX7SmexgbGameKX7zYg77nEuC8515XA51lMoUj s=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: Oln3FXpqFEwxf91ovtV68pqbs9UGCDCbxGbwh9T1JDi2Q5VYNzzFNWKUClKfHHfuVp5jRyXBlU JOQUTuz92tpFOzM1AzVYzHw/V0Db8i3PxcX1JH76BBDX0vEDOu4xkMAh3+TBB7ARP0mxHPzvEv /vumyUYgY/QE2qoX+AM4bU1l0Xsyhbf0ezfITnoM2R0qmXDJJi23pzTUpxTJARbZEultUDfjyN PZ96OhZAsU10WQ8zE03YRDn5WP3HD0D1yt1jGXgjIKTQQsKHv3PBaYZnvedICZr3n6m3LnM2O7 ajXEShY85AnNTT3WdO2DGpJx X-SBRS: 5.1 X-MesageID: 55337888 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:JCPae6nWl2dbiEd8f9ZNu63o5gxPIURdPkR7XQ2eYbSJt1+Wr1Gzt xIeCz+AaaqJYWT2KNgja4Sy9kkBuJSAn4VlTwRpq3hhEyMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA185IMsdoUg7wbdh09Q02YHR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 NpGi4PzZDgUBIOPhN0hAxkHFA9vZoQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBMjkO5lZtmt93zHYC/cgaZvCX7/L9ZlT2zJYasVmQKuFP JVJOWoHgBLoPCUWC28QT68Fk/6ZgUmlcDZg933Oqv9ii4TU5FMoi+W8WDbPQfSSTNhRtlaVo CTB5WuRKhMQOcGbyDGF2mmxneKJliT+M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o8/ xG+c5x6faaslossR0b9uxoW5PhfZq/z/BICOAqVN/JMTUO01HIEKhSqafk3j38C2nf24dmpM JdmnFFeb7N5I5B/KTH3DU= X-IronPort-AV: E=Sophos;i="5.85,319,1624334400"; d="scan'208";a="55337888" From: Igor Druzhinin To: CC: , , Igor Druzhinin Subject: [PATCH v2] pci: fix handling of PCI bridges with subordinate bus number 0xff Date: Fri, 24 Sep 2021 10:10:12 +0100 Message-ID: <1632474612-9940-1-git-send-email-igor.druzhinin@citrix.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1632474652970100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Bus number 0xff is valid according to the PCI spec. Using u8 typed sub_bus and assigning 0xff to it will result in the following loop getting stuck. for ( ; sec_bus <=3D sub_bus; sec_bus++ ) {...} Just change its type to unsigned int similarly to what is already done in dmar_scope_add_buses(). Signed-off-by: Igor Druzhinin Reviewed-by: Bertrand Marquis Reviewed-by: Jan Beulich --- v2: - fix free_pdev() as well - style fixes --- xen/drivers/passthrough/pci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index fc4fa2e..d65cda8 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -363,8 +363,7 @@ static struct pci_dev *alloc_pdev(struct pci_seg *pseg,= u8 bus, u8 devfn) /* update bus2bridge */ switch ( pdev->type =3D pdev_type(pseg->nr, bus, devfn) ) { - u16 cap; - u8 sec_bus, sub_bus; + unsigned int cap, sec_bus, sub_bus; =20 case DEV_TYPE_PCIe2PCI_BRIDGE: case DEV_TYPE_LEGACY_PCI_BRIDGE: @@ -431,7 +430,7 @@ static void free_pdev(struct pci_seg *pseg, struct pci_= dev *pdev) /* update bus2bridge */ switch ( pdev->type ) { - uint8_t sec_bus, sub_bus; + unsigned int sec_bus, sub_bus; =20 case DEV_TYPE_PCIe2PCI_BRIDGE: case DEV_TYPE_LEGACY_PCI_BRIDGE: --=20 2.7.4