summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2015-07-27 00:49:00 +0000
committerlzeng14 <lzeng14@Edk2>2015-07-27 00:49:00 +0000
commitcdc83ccf7195c66c77b869ee62155108e39a0246 (patch)
tree01c7f571700dd3e63b088b714fe5f426928f3f4b
parent88656abf1b3a690969851880ba2b134e0d144625 (diff)
downloadedk2-platforms-cdc83ccf7195c66c77b869ee62155108e39a0246.tar.xz
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
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c
index 9067f64f15..615b4cec28 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c
@@ -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;
}