MdeModulePkg: Add the alignment check for FTW spare area address and length, and add the check for PcdFlashNvStorageVariableSize <= PcdFlashNvStorageFtwSpareSize.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14463 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1111,6 +1111,20 @@ FindFvbForFtw (
|
||||
ASSERT (FALSE);
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
//
|
||||
// Check the alignment of spare area address and length, they should be block size aligned
|
||||
//
|
||||
if (((FtwDevice->SpareAreaAddress & (FtwDevice->BlockSize - 1)) != 0) ||
|
||||
((FtwDevice->SpareAreaLength & (FtwDevice->BlockSize - 1)) != 0)) {
|
||||
DEBUG ((EFI_D_ERROR, "Ftw: Spare area address or length is not block size aligned\n"));
|
||||
FreePool (HandleBuffer);
|
||||
//
|
||||
// Report Status Code EFI_SW_EC_ABORTED.
|
||||
//
|
||||
REPORT_STATUS_CODE ( (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED), (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ABORTED));
|
||||
ASSERT (FALSE);
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1118,12 +1132,12 @@ FindFvbForFtw (
|
||||
}
|
||||
}
|
||||
FreePool (HandleBuffer);
|
||||
|
||||
|
||||
if ((FtwDevice->FtwBackupFvb == NULL) || (FtwDevice->FtwFvBlock == NULL) ||
|
||||
(FtwDevice->FtwWorkSpaceLba == (EFI_LBA) (-1)) || (FtwDevice->FtwSpareLba == (EFI_LBA) (-1))) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user