MdeModulePkg SmmLockBox: Return updated Length for EFI_BUFFER_TOO_SMALL
authorStar Zeng <star.zeng@intel.com>
Sat, 24 Feb 2018 08:02:07 +0000 (16:02 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 26 Feb 2018 06:03:23 +0000 (14:03 +0800)
The updated Length value should be returned
for EFI_BUFFER_TOO_SMALL case.

Cc: Jiewen Yao <jiewen.yao@intel.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>
MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c

index 2dc8815..d4183ca 100644 (file)
@@ -9,7 +9,7 @@
   SmmLockBoxHandler(), SmmLockBoxRestore(), SmmLockBoxUpdate(), SmmLockBoxSave()\r
   will receive untrusted input and do basic validation.\r
 \r
-Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -217,6 +217,9 @@ SmmLockBoxRestore (
                (VOID *)(UINTN)TempLockBoxParameterRestore.Buffer,\r
                (UINTN *)&TempLockBoxParameterRestore.Length\r
                );\r
+    if (Status == EFI_BUFFER_TOO_SMALL) {\r
+      LockBoxParameterRestore->Length = TempLockBoxParameterRestore.Length;\r
+    }\r
   }\r
   LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status;\r
   return ;\r