From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EB47081C8C for ; Wed, 2 Nov 2016 20:02:26 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP; 02 Nov 2016 20:02:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,436,1473145200"; d="scan'208";a="27166545" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga004.jf.intel.com with ESMTP; 02 Nov 2016 20:02:28 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 2 Nov 2016 20:02:27 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Thu, 3 Nov 2016 11:02:24 +0800 From: "Zeng, Star" To: Cinnamon Shia , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg/PCD: Fix PcdGetNextToken may get a wrong PCD token Thread-Index: AQHSNLKF99jKUDOJiUqUIyYIRZumbKDGk9Ew Date: Thu, 3 Nov 2016 03:02:23 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB04831039595AEA@shsmsx102.ccr.corp.intel.com> References: <20161102024034.260-1-cinnamon.shia@hpe.com> In-Reply-To: <20161102024034.260-1-cinnamon.shia@hpe.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/PCD: Fix PcdGetNextToken may get a wrong PCD token X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 03:02:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng And pushed at bfb4c2ba3742b61ef778e07957ff1b26b5a159b5. Thanks for the contribution. Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Cinn= amon Shia Sent: Wednesday, November 2, 2016 10:41 AM To: edk2-devel@lists.01.org Cc: Tian, Feng ; Zeng, Star Subject: [edk2] [PATCH] MdeModulePkg/PCD: Fix PcdGetNextToken may get a wro= ng PCD token If there are two DynamicEx PCDs have the same PCD token number but in diffe= rent PCD token spaces, the PcdGetNextToken function may get the wrong PCD t= oken. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia --- MdeModulePkg/Universal/PCD/Dxe/Service.c | 3 ++- MdeModulePkg/Universal/PCD/Pei/Pcd.c | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Univer= sal/PCD/Dxe/Service.c index 6d0b0f8..bf77130 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -3,6 +3,7 @@ =20 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
Copyrig= ht (c) 2006 - 2016, Intel Corporation. All rights reserved.
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -715,7 +71= 6,7 @@ ExGetNextTokeNumber ( } =20 for ( ; Index < ExMapTableCount; Index++) { - if (ExMapTable[Index].ExTokenNumber =3D=3D *TokenNumber) { + if ((ExMapTable[Index].ExTokenNumber =3D=3D *TokenNumber) &&=20 + (ExMapTable[Index].ExGuidIndex =3D=3D GuidTableIdx)) { break; } } diff --git a/MdeModulePkg/Universal/PCD/Pei/Pcd.c b/MdeModulePkg/Universal/= PCD/Pei/Pcd.c index 7a486b7..668860b 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Pcd.c +++ b/MdeModulePkg/Universal/PCD/Pei/Pcd.c @@ -2,13 +2,14 @@ All Pcd Ppi services are implemented here. =20 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
-This program and the accompanying materials =20 -are licensed and made available under the terms and conditions of the BSD = License =20 -which accompanies this distribution. The full text of the license may be = found at =20 -http://opensource.org/licenses/bsd-license.php = =20 - = =20 -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, = =20 -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. =20 +(C) Copyright 2016 Hewlett Packard Enterprise Development LP
This=20 +program and the accompanying materials are licensed and made available=20 +under the terms and conditions of the BSD License which accompanies=20 +this distribution. The full text of the license may be found at=20 +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,=20 +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. =20 **/ =20 @@ -1116,13 +1117,17 @@ PeiPcdGetNextToken ( } =20 if (Found) { + // + // If given token number is PCD_INVALID_TOKEN_NUMBER, then return th= e first + // token number in found token space. + // if (*TokenNumber =3D=3D PCD_INVALID_TOKEN_NUMBER) { *TokenNumber =3D ExMapTable[Index].ExTokenNumber; return EFI_SUCCESS; } =20 for ( ; Index < PeiPcdDb->ExTokenCount; Index++) { - if (ExMapTable[Index].ExTokenNumber =3D=3D *TokenNumber) { + if ((ExMapTable[Index].ExTokenNumber =3D=3D *TokenNumber) &&=20 + (ExMapTable[Index].ExGuidIndex =3D=3D GuidTableIdx)) { break; } } -- 2.10.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel