PCI: acpiphp_ibm: Avoid uninitialized variable reference
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 15 Apr 2016 14:51:06 +0000 (17:51 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 15 Apr 2016 15:17:03 +0000 (10:17 -0500)
If ibm_get_table_from_acpi() fails then "table" isn't initialized.  Check
for failure so we don't reference "table" unless it's been initialized.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/acpiphp_ibm.c

index 2f6d3a1c1726ef0032723cb36a0418603e9dd63c..f6221d739f59d73bfb09f49bc66a8cf33b2e9cdf 100644 (file)
@@ -138,6 +138,8 @@ static union apci_descriptor *ibm_slot_from_id(int id)
        char *table;
 
        size = ibm_get_table_from_acpi(&table);
+       if (size < 0)
+               return NULL;
        des = (union apci_descriptor *)table;
        if (memcmp(des->header.sig, "aPCI", 4) != 0)
                goto ibm_slot_done;