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
This commit is contained in:
li-elvin 2011-08-25 08:25:13 +00:00
parent f6c014fb14
commit 1476a25761
1 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,6 @@
/** @file
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
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 ;
}