mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-24 06:04:52 +02:00
PcAtChipsetPkg/PcRtc: Fix a NULL pointer deference issue
When a platform which doesn't support ACPI 1.0 (no XSDT) and FADT is not produced at the first time when ACPI table is published, GetCenturyRtcAddress() unconditionally deference Rsdp->RsdtAddress but Rsdp->RsdtAddress is 0 in this case. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
96fcfdbfb0
commit
c8ecaaf5e3
@ -1250,8 +1250,6 @@ GetCenturyRtcAddress (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
|
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
|
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
|
||||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
|
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
|
||||||
@ -1259,27 +1257,32 @@ GetCenturyRtcAddress (
|
|||||||
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
|
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Rsdp != NULL);
|
Fadt = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find FADT in XSDT
|
// Find FADT in XSDT
|
||||||
//
|
//
|
||||||
Fadt = NULL;
|
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
|
||||||
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
|
Fadt = ScanTableInSDT (
|
||||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress;
|
(EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress,
|
||||||
Fadt = ScanTableInSDT (Xsdt, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, sizeof (UINTN));
|
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||||
|
sizeof (UINTN)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Fadt == NULL) {
|
//
|
||||||
//
|
// Find FADT in RSDT
|
||||||
// Find FADT in RSDT
|
//
|
||||||
//
|
if (Fadt == NULL && Rsdp->RsdtAddress != 0) {
|
||||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
|
Fadt = ScanTableInSDT (
|
||||||
Fadt = ScanTableInSDT (Rsdt, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, sizeof (UINT32));
|
(EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress,
|
||||||
|
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||||
|
sizeof (UINT32)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Fadt != NULL) &&
|
if ((Fadt != NULL) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user