[PATCH 4/4] pci: aspm: check that a table exists, fixes segv on arm64

Colin King colin.king at canonical.com
Thu Apr 23 11:57:38 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

A recently tested ARM64 platform did not load a FACP causing the
table to be null and a null pointer deference occurred. Fix this
by checking for a null before proceeding with the test.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/pci/aspm/aspm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/pci/aspm/aspm.c b/src/pci/aspm/aspm.c
index 0851c22..8d431b1 100644
--- a/src/pci/aspm/aspm.c
+++ b/src/pci/aspm/aspm.c
@@ -56,6 +56,8 @@ static int facp_get_aspm_control(fwts_framework *fw)
 	if (fwts_acpi_find_table(fw, "FACP", 0, &table) != FWTS_OK) {
 		return FWTS_ERROR;
 	}
+	if (table == NULL)
+		return FWTS_ERROR;
 	fadt = (fwts_acpi_table_fadt*)table->data;
 
 	if ((fadt->iapc_boot_arch & FWTS_FACP_IAPC_BOOT_ARCH_PCIE_ASPM_CONTROLS) == 0) {
-- 
2.1.4




More information about the fwts-devel mailing list