]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PCD: Fix PcdGetNextToken may get a wrong PCD token
authorCinnamon Shia <cinnamon.shia@hpe.com>
Wed, 2 Nov 2016 02:40:34 +0000 (10:40 +0800)
committerStar Zeng <star.zeng@intel.com>
Thu, 3 Nov 2016 03:00:52 +0000 (11:00 +0800)
If there are two DynamicEx PCDs have the same PCD token number but
in different PCD token spaces, the PcdGetNextToken function may get
the wrong PCD token.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Universal/PCD/Dxe/Service.c
MdeModulePkg/Universal/PCD/Pei/Pcd.c

index 6d0b0f8adec6af82bbe51671ae54f9c683a437ae..bf7713017094d902c61d523c685986a57b9562b4 100644 (file)
@@ -3,6 +3,7 @@
 \r
 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -715,7 +716,7 @@ ExGetNextTokeNumber (
     }\r
 \r
     for ( ; Index < ExMapTableCount; Index++) {\r
-      if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {\r
+      if ((ExMapTable[Index].ExTokenNumber == *TokenNumber) && (ExMapTable[Index].ExGuidIndex == GuidTableIdx)) {\r
         break;\r
       }\r
     }\r
index 7a486b7d1d0503be801f5b948b158e210e6f0735..668860b61c6ccb3590a51002e578451731c76779 100644 (file)
@@ -2,13 +2,14 @@
   All Pcd Ppi services are implemented here.\r
   \r
 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
@@ -1116,13 +1117,17 @@ PeiPcdGetNextToken (
     }\r
 \r
     if (Found) {\r
+      //\r
+      // If given token number is PCD_INVALID_TOKEN_NUMBER, then return the first\r
+      // token number in found token space.\r
+      //\r
       if (*TokenNumber == PCD_INVALID_TOKEN_NUMBER) {\r
         *TokenNumber = ExMapTable[Index].ExTokenNumber;\r
          return EFI_SUCCESS;\r
       }\r
 \r
       for ( ; Index < PeiPcdDb->ExTokenCount; Index++) {\r
-        if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {\r
+        if ((ExMapTable[Index].ExTokenNumber == *TokenNumber) && (ExMapTable[Index].ExGuidIndex == GuidTableIdx)) {\r
           break;\r
         }\r
       }\r