MdeModulePkg Variable: ###VariableTotalSize need to be initialized to 0 first

HwErrVariableTotalSize/CommonVariableTotalSize/CommonUserVariableTotalSize
need to be initialized to 0 first after reclaim failed, then to be assigned by += operation.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19572 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2015-12-29 09:00:58 +00:00 committed by lzeng14
parent 3af5808515
commit b2c59ce83c
1 changed files with 3 additions and 0 deletions

View File

@ -1191,6 +1191,9 @@ Reclaim (
mVariableModuleGlobal->CommonVariableTotalSize = CommonVariableTotalSize; mVariableModuleGlobal->CommonVariableTotalSize = CommonVariableTotalSize;
mVariableModuleGlobal->CommonUserVariableTotalSize = CommonUserVariableTotalSize; mVariableModuleGlobal->CommonUserVariableTotalSize = CommonUserVariableTotalSize;
} else { } else {
mVariableModuleGlobal->HwErrVariableTotalSize = 0;
mVariableModuleGlobal->CommonVariableTotalSize = 0;
mVariableModuleGlobal->CommonUserVariableTotalSize = 0;
Variable = GetStartPointer ((VARIABLE_STORE_HEADER *)(UINTN)VariableBase); Variable = GetStartPointer ((VARIABLE_STORE_HEADER *)(UINTN)VariableBase);
while (IsValidVariableHeader (Variable, GetEndPointer ((VARIABLE_STORE_HEADER *)(UINTN)VariableBase))) { while (IsValidVariableHeader (Variable, GetEndPointer ((VARIABLE_STORE_HEADER *)(UINTN)VariableBase))) {
NextVariable = GetNextVariablePtr (Variable); NextVariable = GetNextVariablePtr (Variable);