From: lgao4 Date: Wed, 27 Feb 2013 03:01:40 +0000 (+0000) Subject: Adds ASSERT check in DxePcd driver when error status of read DynamicHii PCD is not... X-Git-Tag: edk2-stable201903~12698 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=0b1ef27500a2c5cb5ea248d808dd73cc90335d7f;p=mirror_edk2.git Adds ASSERT check in DxePcd driver when error status of read DynamicHii PCD is not EFI_NOT_FOUND to avoid the incorrect value is used. Signed-off-by: Liming Gao Reviewed-by: Star Zeng git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14147 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c index 53780dca9f..6eaadd6cce 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c @@ -1,7 +1,7 @@ /** @file Help functions used by PCD DXE driver. -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -150,6 +150,11 @@ GetWorker ( // GetPtrTypeSize (TmpTokenNumber, &GetSize); } + // + // If the operation is successful, we copy the data + // to the default value buffer in the PCD Database. + // So that we can free the Data allocated in GetHiiVariable. + // CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize); FreePool (Data); } @@ -166,19 +171,14 @@ GetWorker ( // GetPtrTypeSize (TmpTokenNumber, &GetSize); } + // + // If the operation is successful, we copy the data + // to the default value buffer in the PCD Database. + // So that we can free the Data allocated in GetHiiVariable. + // CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize); FreePool (Data); } - // - // If the operation is successful, we copy the data - // to the default value buffer in the PCD Database. - // So that we can free the Data allocated in GetHiiVariable. - // - // - // If the operation is not successful, - // Return 1) either the default value specified by Platform Integrator - // 2) Or the value Set by a PCD set operation. - // RetPtr = (VOID *) VaraiableDefaultBuffer; } break; @@ -535,6 +535,12 @@ GetHiiVariable ( ASSERT (Status == EFI_SUCCESS); *VariableData = Buffer; *VariableSize = Size; + } else { + // + // Use Default Data only when variable is not found. + // For other error status, correct data can't be got, and trig ASSERT(). + // + ASSERT (Status == EFI_NOT_FOUND); } return Status;