From: li-elvin Date: Thu, 25 Aug 2011 08:25:13 +0000 (+0000) Subject: RestoreLockBox in DXE with Length NULL, Buffer NULL will fail to get data from Lockbo... X-Git-Tag: edk2-stable201903~14338 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=1476a2576160018e56f628fe85c3d23b2db959a8 RestoreLockBox in DXE with Length NULL, Buffer NULL will fail to get data from Lockbox. Fix this issue. Signed-off-by: li-elvin Reviewed-by: jyao1 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12208 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c index 1f9c3b4836..35862c6223 100644 --- a/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c +++ b/MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -183,11 +183,19 @@ SmmLockBoxRestore ( // // Restore data // - Status = RestoreLockBox ( - &LockBoxParameterRestore->Guid, - (VOID *)(UINTN)LockBoxParameterRestore->Buffer, - (UINTN *)&LockBoxParameterRestore->Length - ); + if ((LockBoxParameterRestore->Length == 0) && (LockBoxParameterRestore->Buffer == 0)) { + Status = RestoreLockBox ( + &LockBoxParameterRestore->Guid, + NULL, + NULL + ); + } else { + Status = RestoreLockBox ( + &LockBoxParameterRestore->Guid, + (VOID *)(UINTN)LockBoxParameterRestore->Buffer, + (UINTN *)&LockBoxParameterRestore->Length + ); + } LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status; return ; }