MdeModulePkg Variable: Read MonotonicCount by ReadUnaligned64()

As variable HEADER_ALIGNMENT = 4, the MonotonicCount in
AUTHENTICATED_VARIABLE_HEADER may be not UINT64 aligned,
so go to use ReadUnaligned64() to ensure read data correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18064 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Star Zeng 2015-07-27 00:49:00 +00:00 committed by lzeng14
parent 88656abf1b
commit cdc83ccf71
1 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ VariableExLibFindVariable (
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *) Variable.CurrPtr;
AuthVariableInfo->PubKeyIndex = AuthVariable->PubKeyIndex;
AuthVariableInfo->MonotonicCount = AuthVariable->MonotonicCount;
AuthVariableInfo->MonotonicCount = ReadUnaligned64 (&(AuthVariable->MonotonicCount));
AuthVariableInfo->TimeStamp = &AuthVariable->TimeStamp;
}
@ -129,7 +129,7 @@ VariableExLibFindNextVariable (
if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
AuthVariablePtr = (AUTHENTICATED_VARIABLE_HEADER *) VariablePtr;
AuthVariableInfo->PubKeyIndex = AuthVariablePtr->PubKeyIndex;
AuthVariableInfo->MonotonicCount = AuthVariablePtr->MonotonicCount;
AuthVariableInfo->MonotonicCount = ReadUnaligned64 (&(AuthVariablePtr->MonotonicCount));
AuthVariableInfo->TimeStamp = &AuthVariablePtr->TimeStamp;
}