summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Universal/PCD/Dxe/Pcd.c')
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Pcd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c b/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
index 45a6c5932a..55040fe159 100644
--- a/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
+++ b/EdkModulePkg/Universal/PCD/Dxe/Pcd.c
@@ -183,7 +183,13 @@ DxePcdGetSize (
)
{
UINT16 * SizeTable;
-
+ //
+ // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
+ // We have to decrement TokenNumber by 1 to make it usable
+ // as the array index.
+ //
+ TokenNumber--;
+
SizeTable = (TokenNumber < PEI_LOCAL_TOKEN_NUMBER) ? mPcdDatabase->PeiDb.Init.SizeTable :
mPcdDatabase->DxeDb.Init.SizeTable;
@@ -493,7 +499,7 @@ DxeUnRegisterCallBackOnSet (
{
ASSERT (CallBackFunction != NULL);
- return DxeRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);
+ return DxeUnRegisterCallBackWorker (TokenNumber, Guid, CallBackFunction);
}