MdeModulePkg SmmLockBox: Return actual data length in SmmLockBoxRestore

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1082

Current code only returns actual data length in case of return status
buffer too small.
If caller provided a buffer that's large enough to restore data from
lock box, actual data length is not returned. It needs to be updated
in case of return status as success as well.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Anbazhagan Baraneedharan <anbazhagan@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
Star Zeng 2018-08-13 16:50:37 +08:00
parent a6daab1f6c
commit a9ae5b37bf
1 changed files with 4 additions and 1 deletions

View File

@ -217,7 +217,10 @@ SmmLockBoxRestore (
(VOID *)(UINTN)TempLockBoxParameterRestore.Buffer, (VOID *)(UINTN)TempLockBoxParameterRestore.Buffer,
(UINTN *)&TempLockBoxParameterRestore.Length (UINTN *)&TempLockBoxParameterRestore.Length
); );
if (Status == EFI_BUFFER_TOO_SMALL) { if ((Status == EFI_BUFFER_TOO_SMALL) || (Status == EFI_SUCCESS)) {
//
// Return the actual Length value.
//
LockBoxParameterRestore->Length = TempLockBoxParameterRestore.Length; LockBoxParameterRestore->Length = TempLockBoxParameterRestore.Length;
} }
} }