MdeModulePkg Variable: Fix the returned status in UpdateVariableStore

If Fvb is a NULL, return EFI_UNSUPPORTED.
If the remaining size is not enough, return EFI_OUT_OF_RESOURCES.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: cinnamon shia <cinnamon.shia@hpe.com>
Signed-off-by: Ansen Huang <ansen.huang@hpe.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
cinnamon shia 2018-05-11 23:21:12 +08:00 committed by Star Zeng
parent d741d14193
commit 989f7a2cf0
1 changed files with 5 additions and 3 deletions

View File

@ -238,6 +238,8 @@ IsValidVariableHeader (
@param Buffer Pointer to the buffer from which data is written. @param Buffer Pointer to the buffer from which data is written.
@retval EFI_INVALID_PARAMETER Parameters not valid. @retval EFI_INVALID_PARAMETER Parameters not valid.
@retval EFI_UNSUPPORTED Fvb is a NULL for Non-Volatile variable update.
@retval EFI_OUT_OF_RESOURCES The remaining size is not enough.
@retval EFI_SUCCESS Variable store successfully updated. @retval EFI_SUCCESS Variable store successfully updated.
**/ **/
@ -274,7 +276,7 @@ UpdateVariableStore (
// //
if (!Volatile) { if (!Volatile) {
if (Fvb == NULL) { if (Fvb == NULL) {
return EFI_INVALID_PARAMETER; return EFI_UNSUPPORTED;
} }
Status = Fvb->GetPhysicalAddress(Fvb, &FvVolHdr); Status = Fvb->GetPhysicalAddress(Fvb, &FvVolHdr);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
@ -289,7 +291,7 @@ UpdateVariableStore (
} }
if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) { if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) FwVolHeader + FwVolHeader->FvLength))) {
return EFI_INVALID_PARAMETER; return EFI_OUT_OF_RESOURCES;
} }
} else { } else {
// //
@ -302,7 +304,7 @@ UpdateVariableStore (
} }
if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) { if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + VolatileBase->Size))) {
return EFI_INVALID_PARAMETER; return EFI_OUT_OF_RESOURCES;
} }
// //