From nobody Sun Apr 28 03:19:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90608+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90608+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655708908; cv=none; d=zohomail.com; s=zohoarc; b=AozxbAFH2n/VWVqJ5LLGdcEYJfd4wmLgCgUxO2EmxzFzsuoBrvomPFd2LRjuS4//KmZ3UfMPO9mKDKfu7MhH8cr+zDnQn8xlWk9PogEyl/s4Gyw+jKm1BaQeaON4YgUiDMRyvVVc1WCSMnkgl5L0aEgYmCXYHDDGaHT+d0xXFTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655708908; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=3Xz1tpjeDHDbO062hWhf1nwhnAdtaPHLJk6ftwr2aXU=; b=YjUaC/Gl+wBtrh0FNv+xnW9TWk2B2vtpJ4nw+Hbgl4UD7VuEKrc+2/KGp4Wcp4WQjrYgX/8LpqRzQD1MfliUlqdCv1/bl9j5eNmlIMIRhIntrKsqgPOI1CcSHUziI5qL0cu7yqGYvpb8nbpc8WfHEIGY8j3vEnltdxWCMt3npgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90608+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655708908450676.6135508814846; Mon, 20 Jun 2022 00:08:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6uNfYY1788612xmk5NXaZSXJ; Mon, 20 Jun 2022 00:08:28 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.17095.1655708906033756111 for ; Mon, 20 Jun 2022 00:08:26 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="259645073" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="259645073" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 00:08:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="642977449" X-Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.141]) by fmsmga008.fm.intel.com with ESMTP; 20 Jun 2022 00:08:24 -0700 From: "Heng Luo" To: devel@edk2.groups.io Cc: Ray Ni , Hao Wu Subject: [edk2-devel] [Patch V2] XhcCreateUsbHc: Check return value of XHC_PAGESIZE_OFFSET Date: Mon, 20 Jun 2022 15:08:16 +0800 Message-Id: <20220620070816.648-1-heng.luo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,heng.luo@intel.com X-Gm-Message-State: 36XkQTePM3lRNx64ra3vEgI5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655708908; bh=pLowcVnFxw3ITczdxs+0B1ryhskWY8IyubW9OiV4/9g=; h=Cc:Date:From:Reply-To:Subject:To; b=qZX70lp9gBmuAnZWUBi7DXCz+WsDa6Drmy7Kra3TwvwOtWk/3fu/qmlVkBACea/RYXJ 6DGxDvN2yYCzKhQogrFE3I8cx83yc3R5FoahsqE6gOv2vlBIMSPssxklgmdNwPWkqWTWf 3CJ3TkobsxQB0BnZ8QjYz7aCtN9HQBh9lug= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655708909153100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3954 Report error if reserved bits are not 0 for PageSize Cc: Ray Ni Cc: Hao Wu Signed-off-by: Heng Luo Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/Xhc= iDxe/Xhci.c index b79499e225..381d7a9536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -1,7 +1,7 @@ /** @file The XHCI controller driver. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1813,7 +1813,13 @@ XhcCreateUsbHc ( // This xHC supports a page size of 2^(n+12) if bit n is Set. For exampl= e, // if bit 0 is Set, the xHC supports 4k byte page sizes. // - PageSize =3D XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET) & XHC_PAGESIZE= _MASK; + PageSize =3D XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET); + if ((PageSize & (~XHC_PAGESIZE_MASK)) !=3D 0) { + DEBUG ((DEBUG_ERROR, "XhcCreateUsb3Hc: Reserved bits are not 0 for Pag= eSize\n")); + goto ON_ERROR; + } + + PageSize &=3D XHC_PAGESIZE_MASK; Xhc->PageSize =3D 1 << (HighBitSet32 (PageSize) + 12); =20 ExtCapReg =3D (UINT16)(Xhc->HcCParams.Data.ExtCapReg); --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90608): https://edk2.groups.io/g/devel/message/90608 Mute This Topic: https://groups.io/mt/91872204/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-