diff options
author | Jiewen Yao <jiewen.yao@intel.com> | 2016-12-22 13:43:37 +0800 |
---|---|---|
committer | Jiewen Yao <jiewen.yao@intel.com> | 2016-12-23 10:08:04 +0800 |
commit | d8487a34f0b931a007e64f02656d1f61882c317d (patch) | |
tree | da2033abec060d9fa0e90fd3261d82ea6049d769 /MdeModulePkg | |
parent | 7e6e4f96069464ed6ee0669e181abe7cb6801223 (diff) | |
download | edk2-platforms-d8487a34f0b931a007e64f02656d1f61882c317d.tar.xz |
MdeModulePkg/CapsuleLib: Add NULL capsule name in record.
According to UEFI spec, capsule report variable should include
a null terminator for capsule name and capsule target, if they are
not present.
The reserved field is zeroed.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c index 25468712a8..d34eb25a6e 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleReportLib.c @@ -104,7 +104,7 @@ IsFmpCapsuleProcessed ( CapsuleResult = &mCapsuleResultVariableCache[Index].CapsuleResultHeader;
if (CapsuleResult->VariableTotalSize >= sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER)) {
if (CompareGuid(&CapsuleResult->CapsuleGuid, &gEfiFmpCapsuleGuid)) {
- if (CapsuleResult->VariableTotalSize >= sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP)) {
+ if (CapsuleResult->VariableTotalSize >= sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2) {
CapsuleResultFmp = (EFI_CAPSULE_RESULT_VARIABLE_FMP *)(CapsuleResult + 1);
if (CompareGuid(&CapsuleResultFmp->UpdateImageTypeId, &ImageHeader->UpdateImageTypeId) &&
(CapsuleResultFmp->UpdateImageIndex == ImageHeader->UpdateImageIndex) &&
@@ -256,6 +256,7 @@ RecordCapsuleStatusVariable ( EFI_STATUS Status;
CapsuleResultVariable.VariableTotalSize = sizeof(CapsuleResultVariable);
+ CapsuleResultVariable.Reserved = 0;
CopyGuid (&CapsuleResultVariable.CapsuleGuid, &CapsuleHeader->CapsuleGuid);
ZeroMem(&CapsuleResultVariable.CapsuleProcessed, sizeof(CapsuleResultVariable.CapsuleProcessed));
gRT->GetTime(&CapsuleResultVariable.CapsuleProcessed, NULL);
@@ -298,13 +299,17 @@ RecordFmpCapsuleStatusVariable ( UINT32 CapsuleResultVariableSize;
CapsuleResultVariable = NULL;
- CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP);
- CapsuleResultVariable = AllocatePool (CapsuleResultVariableSize);
+ //
+ // Allocate zero CHAR16 for CapsuleFileName and CapsuleTarget.
+ //
+ CapsuleResultVariableSize = sizeof(EFI_CAPSULE_RESULT_VARIABLE_HEADER) + sizeof(EFI_CAPSULE_RESULT_VARIABLE_FMP) + sizeof(CHAR16) * 2;
+ CapsuleResultVariable = AllocateZeroPool (CapsuleResultVariableSize);
if (CapsuleResultVariable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CapsuleResultVariableHeader = (VOID *)CapsuleResultVariable;
CapsuleResultVariableHeader->VariableTotalSize = CapsuleResultVariableSize;
+ CapsuleResultVariableHeader->Reserved = 0;
CopyGuid(&CapsuleResultVariableHeader->CapsuleGuid, &CapsuleHeader->CapsuleGuid);
ZeroMem(&CapsuleResultVariableHeader->CapsuleProcessed, sizeof(CapsuleResultVariableHeader->CapsuleProcessed));
gRT->GetTime(&CapsuleResultVariableHeader->CapsuleProcessed, NULL);
|