more security check in acpi patcher

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2021-09-02 18:43:38 +03:00
parent e12aefe816
commit 070037aac1

View File

@ -1123,7 +1123,7 @@ EFI_STATUS DumpFadtTables(EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt, CONST
// Acpi 2.0 or up
// may have it in XDsdt or XFirmwareCtrl
DBG(", XDsdt: %llx, XFacs: %llx", Fadt->XDsdt, Fadt->XFirmwareCtrl);
if (Fadt->XDsdt != 0) {
if ((Fadt->XDsdt != 0) && (Fadt->XDsdt < 0xFFFFFFF0ull)){
DsdtAdr = Fadt->XDsdt;
}
if (Fadt->XFirmwareCtrl != 0) {
@ -1349,9 +1349,10 @@ void DumpTables(void *RsdPtrVoid, CONST CHAR16 *DirName)
DBG(" No Rsdt and Xsdt - exiting.\n");
return;
}
UINT32 Count = 0;
if (Xsdt) {
UINT64 *Ptr, *EndPtr;
UINT32 Count = XsdtTableCount();
Count = XsdtTableCount();
DBG(" Tables in Xsdt: %d\n", Count);
if (Count > 100) Count = 100; //it's enough
@ -1390,13 +1391,13 @@ void DumpTables(void *RsdPtrVoid, CONST CHAR16 *DirName)
}
} // if Xsdt
if (Rsdt) {
if (!Count && Rsdt) {
UINT32 *Ptr, *EndPtr;
// additional Rsdt tables which are not present in Xsdt will have "RSDT-" prefix, like RSDT-FACS.aml
FileNamePrefix = L"RSDT-";
// Take tables from Rsdt
// if saved from Xsdt already, then just print debug
UINT32 Count = RsdtTableCount();
Count = RsdtTableCount();
DBG(" Tables in Rsdt: %d\n", Count);
if (Count > 100) Count = 100; //it's enough
Ptr = RsdtEntryPtrFromIndex(0);