From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.15444.1671432010126782592 for ; Sun, 18 Dec 2022 22:40:10 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=biapspt1; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: hao.a.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671432010; x=1702968010; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=UgvpRy9+TC0pQOgN2PnBwgn/jbzWjcc7VGYtAqWeaQ0=; b=biapspt1nisaMjDxMYlZxODJQEEWNkVmQ5Sg8m9UwLBqqpqa+6LsKIdR 9rtpT/EekwO2hDGjAlWY41qw2DfBg4wd9RQSSDO29vcen0GOnv6rZVZ/5 gGSO2hxNdLISwDtlqeF6s/6Der0qQ4rzVtBn0D7SEG9EwcdPE+QxXuwUn R+YLX3KGkhcFhvXUs9alLJLTXvUfHKpa0IMydeinXRRThXnzUx2hZFwBh 2kdGOeNCCELvuh+oKuC8d54e1tbf/3eCaFElkZ6yKXe/DIir9lgkLjDCb 8gt14orwZjP0Szk7Px3E9ugu4ZSkdgF648fTshUCYXCIbX+dbcVFkkxGx A==; X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="381506332" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="381506332" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2022 22:40:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10565"; a="979284694" X-IronPort-AV: E=Sophos;i="5.96,255,1665471600"; d="scan'208";a="979284694" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 18 Dec 2022 22:40:09 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 18 Dec 2022 22:40:08 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 18 Dec 2022 22:40:08 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Sun, 18 Dec 2022 22:40:08 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.170) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Sun, 18 Dec 2022 22:40:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lazwuaOnTu38O2VqiHmfWiEZHfjnle5SI3sXpbtGN7oNuQgvMctfP8HRZinMpnPYk/S7fVH6ufDHlNkZoiEiNZyqLgmRWOK6KY0mswmW1fsm4m9cc+VnPEhPUY+lld9+cHd4MZIpGDoM7vR2urhJnJh2LJz5dJXEZKHxQrFKNl90xvVWY+ji1cAURh8JTYJEEzv/C2h/0pJtjhr28aXV6a0hVrrrRGymeHNEfuS2UCTQWgxNxA+KOZ8eeT1SVokRmazj4v2dGq8h1o96oAVcRkDXFbOt6Y3JOAy8etxrI1iCKf5pDCBdyRAKp2Oyr6C3T1GtxUHbVJPUglCS8EjeNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PIbsvb/UmBfdwbcomReWS25DodmgAOJ9vu/jfwtcSe4=; b=Mtt0mB/EyVWaS04SLEuaYdOuFU1R0vg6N1l7yGgtgIyco28Ubji9Fvdrk8hiF2a1sGkn6C46Ymdq7Wcgfkz/DLtPTw3e1M9IytMy80kwQgedkh0MXdr72Et/nxFHG9aN4zYpe9Pe7uDxXJOiynBohIqfgRoNPFNKqRq59YWmnQaVfOvsbCTq28ddjTWNZ4SIMJzL1Z7SkrMInaBLCTdTaxCMAoTYrQweFicB/gl6OZyC/cqZd2c34HVvuyjcOVBVc3ygf/zJCA74l0ijmYYsxkM5rybywtQ0uqT8BNB/SLSuR6aKnlVGawiwT35n4JGaODHghMpxqlJpgpXVKzfk9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4025.namprd11.prod.outlook.com (2603:10b6:5:197::31) by SJ2PR11MB7576.namprd11.prod.outlook.com (2603:10b6:a03:4c9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 06:40:05 +0000 Received: from DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c]) by DM6PR11MB4025.namprd11.prod.outlook.com ([fe80::6129:7158:18dd:761c%3]) with mapi id 15.20.5924.016; Mon, 19 Dec 2022 06:40:05 +0000 From: "Wu, Hao A" To: "He, Jiangang" , "Chang, Abner" , "devel@edk2.groups.io" CC: "Lin, Kuei-Hung (Timothy)" , "Ni, Ray" , "Zeng, Star" , "Sun, Zhikai" , "Kirkendall, Garrett" Subject: Re: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Topic: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Thread-Index: AQHZEKUNAvIe4DttyUOOke5o6otGBK50xmkA Date: Mon, 19 Dec 2022 06:40:05 +0000 Message-ID: References: <20221210151240.1548-1-abner.chang@amd.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=13d80729-4da6-44d7-bcc8-e332e37b7689; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-12-15T02:11:41Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR11MB4025:EE_|SJ2PR11MB7576:EE_ x-ms-office365-filtering-correlation-id: 31dae9dc-bcb5-4679-6370-08dae18bdd2e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gWltzqL+Nu4thXvXoIJk+ZCdxt2fJswjPdAvVqlRlG4UpC70sXPb4GPkbQvCuw+NpxeQeYCI/XrSk8YFe5bD/xNihxDAiXVvyxORp1WGOh7Z8Vl1GuTBpz2vODj4DaGy+kwSe4ZT/59HIxviOvwWbTMnIrtVExjDrQcVrbMgAbqfC9ftuRVrCztlVsjrJ94chkL3ELNBTsDFov5hTRdSMDAQmJE+rVo0/o0G28Tx03Eymc6nvQzPD9d1bkhr3ct6Kx/MbBGBfMmMILgdH14hShZNQ2A0yyWrNTaf1rz5WArWUXNon5rMGLiDF5KkzKONJZ5L2UFa2VXf6Jayd8llmnCFnpYVM7Is+eXZuZIvQl9nvKLMex1kgWs64izAqndX4dXi3GIcyX4fvv8n6VRTu3sgFOyY2P2sCfGq0h776GmK3y9LkUuA8jENMVrPvMVmXMaZnR5ZJKZy3fol06Ghv7iBauHQqaa/aT5pd+IRqOyrJzAo8ekqbBXH8LC4Xtxe3Y+VydZZWSdc8ezFVejF+Q2DkxezKAPw9NDd1pEqcsZ8pNuI4vDhlBOMhvbuDSlA+Ey7Q9Yg4EEwDHBlxvj3bQUdlJzT6xxX+gNo9gB/DTa7t0vpRZUCkWhfAku9MWcL1ACto1TOATx4tD7ruaBkBbCbT0MZiyIF3HlawHqxXazcqyLxSPf/R66al1TV7GeHqNamJ2YURuSUwfnB6qwotIYOaCHd9Yv28U84G6IwhYTBnW8ZI4ptXRlQ6Lci1VJA x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4025.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(396003)(376002)(136003)(366004)(39860400002)(451199015)(71200400001)(53546011)(6506007)(7696005)(2906002)(478600001)(966005)(26005)(19627235002)(316002)(54906003)(110136005)(66946007)(76116006)(186003)(9686003)(45080400002)(52536014)(8936002)(41300700001)(8676002)(83380400001)(66476007)(38100700002)(122000001)(82960400001)(33656002)(55016003)(66556008)(5660300002)(86362001)(66446008)(4326008)(64756008)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nsqiVLF2NOEJdO7FigeQRJlptMscZhvZN+7qIXL+qvmKeVunnghyrLo6XCqk?= =?us-ascii?Q?LhfZ1XgJtqHJoLzPYYXDUtiwoq9ObC3KmFLnMQv+abF4rROZdDO9R3M2u5dO?= =?us-ascii?Q?jeoSlIbmUTNHIdxS9/sRUpd+0okUeu/xQugSFUixOQaQKsWDmeCCLdreav0/?= =?us-ascii?Q?6sT3C/KIiXDCLHEPYPqr6abdGYKC0wCpJy4A30RTTeNnCU6PjTU67izbmdSX?= =?us-ascii?Q?53Eadbl7dgiIZ23m6jhvUDQ1R1KeIUuI5KnwQe+mAWAXx/+DCsy3OwbU+QAW?= =?us-ascii?Q?SQUf2TraFo+G1xc6yR7LuiklLaF0xc6C9nerRCXZ8kLpV8U1vGvVyCGBCMfq?= =?us-ascii?Q?I1FZq/1hoSyrTyt7MZ1J37JixiSfaY24kRMCcRwrrszU706NVEICBngD/jus?= =?us-ascii?Q?RPEvvPCF/uNLTru5vtu23pkmv7Tq8OntxK4Uv4RTPOZ0a0WH6vLp4ZA22xH+?= =?us-ascii?Q?itWWM/J+5snrjS1nUzrFIJaPyjaep5LEyVGMowZW7gtN0BOq+5hsD7MDuKFk?= =?us-ascii?Q?I9qS/o3QhbbRgFuxgdhGlApqjLpqILKkwZfRkl3froBTVlhNz9C6M8yAb02l?= =?us-ascii?Q?QRydjCvRZsHZiGDs/arO6j33q2P025OkiagDZLSSrZnicUJixTNxXQlRR9/5?= =?us-ascii?Q?BycV6NpML+/bDO2Z56K2kNAMoVSQ2TYEPuoW7h3DfehpFykOurFMaRIGXvU2?= =?us-ascii?Q?CBLbqzlkAsNvibcbcI/pGwbtXrNMsjTCOhUxumAB7Wpbfkzu1jJoqBf8nwbA?= =?us-ascii?Q?HDrIB0r1j0R715nkpKMR/30lTTVOmBduZWfHtBGEqvX1ObD7rzKSiJBLYqCf?= =?us-ascii?Q?m/EukOdMmqZ3CzHYxe69rBoOvpyhexYJtknOD3DAKlmVFZAGw9YhE6aDcmAM?= =?us-ascii?Q?5sb2lnRh38iq8FkCkcMoETx6U7H6gL7yKsqZR6P3xYrMKZD52Uz3ZIHThOo3?= =?us-ascii?Q?aPiyavmJSuQw0f2Byvcc7eHdWk+zQwEhhWS10xoIfABI/vtNlLJ1sDSEzSFC?= =?us-ascii?Q?8hKMw9KJR3KGO8cZCNTfzJBs6CjeLmQta29YZCRZtwGgRg4RwfRPUuDHchiH?= =?us-ascii?Q?JgXHPSP4mR7OkwfGsxUbtPmFmjwF42f9MSIYsOE/A2Q9UNUgs8NOWX8XGAic?= =?us-ascii?Q?7iu7jlyRnQzOu0PQwnT2h0Q0nImuRhYSVlCrrg5zKm+z6uiE5VYW3ePR0HZZ?= =?us-ascii?Q?YderncKNBZKBwKNSVUu3ZRfRGT+IVLRfPoBoiVhS5Nq4MKEF+VAXHVCbL8Xv?= =?us-ascii?Q?JwiDkFA4PJtG4nm5UMPNYCdhYppSNJ9WS0n8ZrSLSBTENgUavefLSd+rFq97?= =?us-ascii?Q?0HWN3cOnTzeSl1uZdrlsDJ/75WgV4iztoatwRTDJBHPkNORzn/YThBIr9KXS?= =?us-ascii?Q?LlUE6sNCSS+8XTdQN31FzQWo8OPY8iQxd09v5KXJJ9+BYYmW9bx6oJNqH1WF?= =?us-ascii?Q?4BCymKo0Dh9NjaxxfQcV471SNgmeikxj7oexlzYNtg/epQriTdCC0Jtp8Iya?= =?us-ascii?Q?omzkXNednhI0AuIwqpa23UMC2qI9vTzs4MKd3x+k5WtR7ydQRslFKAweezAd?= =?us-ascii?Q?dFlTqRdRn2cpEhnHXrcHMDwvfDfPbkNWns7dfWEw?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4025.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31dae9dc-bcb5-4679-6370-08dae18bdd2e X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Dec 2022 06:40:05.3698 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pe4uSTFwarRxYO12I0m8dzQG71YQibm64ACueOOFB/bxat/1sgLmis6U/fsJvP2tHv/Au1IG5fvxO600ubxtSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7576 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, My take is that unlike in DXE, the UsbHcFreeMemBlock() implementation in PE= I phase does not perform freeing the memory. So I think both the solution: * Provided at https://edk2.groups.io/g/devel/topic/92833071#92165, which al= igns with EhciPei * Mentioned at the end of your previous reply, which aligns with XhciDxe should work fine. I will leave it to you for the final decision. Best Regards, Hao Wu > -----Original Message----- > From: He, Jiangang > Sent: Friday, December 16, 2022 12:48 AM > To: Chang, Abner ; Wu, Hao A > ; devel@edk2.groups.io > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > ; Zeng, Star ; Sun, Zhikai > ; Kirkendall, Garrett > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > block >=20 > [AMD Official Use Only - General] >=20 > Yes, it is the same issue discussed in > https://edk2.groups.io/g/devel/topic/92833071#92165 >=20 > MdeModulePkg\Bus\Pci\XhciPei\UsbHcMem.c >=20 > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Head-= >Next) { > // UsbHcUnlinkMemBlock (Pool->Head, Block); > UsbHcFreeMemBlock (Pool, Block); > } > Block =3D Pool->Head->Next never change without calling > UsbHcUnlinkMemBlock (Pool->Head, Block), therefore dead loop. >=20 > Our proposed fix came from dxe version of the equivalent file > MdeModulePkg\Bus\Pci\XhciDxe\UsbHcMem.c but swapped two routine call > order (Now I think it is incorrect as clarified below). > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Head-= >Next) { > UsbHcFreeMemBlock (Pool, Block); > UsbHcUnlinkMemBlock (Pool->Head, Block); > } >=20 > https://edk2.groups.io/g/devel/topic/92833071#92165 proposed fix: >=20 > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Block ->Nex= t) { > // UsbHcUnlinkMemBlock (Pool->Head, Block); > UsbHcFreeMemBlock (Pool, Block); > } >=20 > I think it again, both proposals have problem of reading memory content i= n > the buffer that has just been freed. >=20 > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D Pool->Head-= >Next) { > UsbHcUnlinkMemBlock (Pool->Head, Block); > UsbHcFreeMemBlock (Pool, Block); > } > is right solution and matches dxe version of UsbHcMem.c. >=20 > Thanks, > Jiangang >=20 > -----Original Message----- > From: Chang, Abner > Sent: Wednesday, December 14, 2022 8:12 PM > To: Wu, Hao A ; devel@edk2.groups.io > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > ; Zeng, Star ; Sun, Zhikai > ; Kirkendall, Garrett ; > He, Jiangang > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > block >=20 > [AMD Official Use Only - General] >=20 > Hi Jiangang, > Could you please provide the context of this patch? >=20 > Thanks > Abner >=20 > > -----Original Message----- > > From: Wu, Hao A > > Sent: Monday, December 12, 2022 11:27 AM > > To: Chang, Abner ; devel@edk2.groups.io > > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray > > ; Zeng, Star ; Sun, Zhikai > > ; Kirkendall, Garrett > > > > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > > block > > > > Caution: This message originated from an External Source. Use proper > > caution when opening attachments, clicking links, or responding. > > > > > > Sorry for a question, may I know what issue was met that leads to the > > proposed patch? > > Could you help to check if it is related with the topic discussed in > > > https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fedk2 > > .gr > > > oups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=3D05%7C0 > 1%7 > > > Cabner.chang%40amd.com%7Ccac49c2820e741b8c48a08dadbf0cc24%7C3d > d8 > > > 961fe4884e608e11a82d994e183d%7C0%7C0%7C638064124512265992%7C > Unk > > > nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I > k1h > > > aWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3Dz1Q7NRxN4GMA > %2 > > FBxYd2D7Gnkc3aTD23mRnwNF3H5wE0k%3D&reserved=3D0? Thanks in > advance. > > > > Best Regards, > > Hao Wu > > > > > -----Original Message----- > > > From: abner.chang@amd.com > > > Sent: Saturday, December 10, 2022 11:13 PM > > > To: devel@edk2.groups.io > > > Cc: Kuei-Hung.Lin@amd.com; Wu, Hao A ; Ni, Ray > > > ; Garrett Kirkendall ; > > > Abner Chang > > > Subject: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory > > > block > > > > > > From: Abner Chang > > > > > > In V2: Add AMD copyright. > > > > > > Unlink the XhciPei memory block when it has been freed. > > > > > > Signed-off-by: Kuei-Hung Lin > > > Cc: Hao A Wu > > > Cc: Ray Ni > > > Cc: Garrett Kirkendall > > > Cc: Abner Chang > > > --- > > > MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 29 > > > ++++++++++++++++++++++++- > > > 1 file changed, 28 insertions(+), 1 deletion(-) > > > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > index c64b38fcfc8..39ba31b0913 100644 > > > --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c > > > @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid > based > > > on gPeiUsbControllerPpiGuid which is used to enable recovery > > > function from USB Drivers. > > > > > > Copyright (c) 2014 - 2016, Intel Corporation. All rights > > > reserved.
> > > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights > > > +reserved.
> > > > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > @@ -365,6 +366,32 @@ UsbHcInitMemPool ( > > > return Pool; > > > } > > > > > > +/** > > > + Unlink the memory block from the pool's list. > > > + > > > + @param Head The block list head of the memory's pool. > > > + @param BlockToUnlink The memory block to unlink. > > > + > > > +**/ > > > +VOID > > > +UsbHcUnlinkMemBlock ( > > > + IN USBHC_MEM_BLOCK *Head, > > > + IN USBHC_MEM_BLOCK *BlockToUnlink > > > + ) > > > +{ > > > + USBHC_MEM_BLOCK *Block; > > > + > > > + ASSERT ((Head !=3D NULL) && (BlockToUnlink !=3D NULL)); > > > + > > > + for (Block =3D Head; Block !=3D NULL; Block =3D Block->Next) { > > > + if (Block->Next =3D=3D BlockToUnlink) { > > > + Block->Next =3D BlockToUnlink->Next; > > > + BlockToUnlink->Next =3D NULL; > > > + break; > > > + } > > > + } > > > +} > > > + > > > /** > > > Release the memory management pool. > > > > > > @@ -386,8 +413,8 @@ UsbHcFreeMemPool ( > > > // first block. > > > // > > > for (Block =3D Pool->Head->Next; Block !=3D NULL; Block =3D > > > Pool->Head->Next) { > > > - // UsbHcUnlinkMemBlock (Pool->Head, Block); > > > UsbHcFreeMemBlock (Pool, Block); > > > + UsbHcUnlinkMemBlock (Pool->Head, Block); > > > } > > > > > > UsbHcFreeMemBlock (Pool, Pool->Head); > > > -- > > > 2.37.1.windows.1