浏览代码

PCI: acpiphp_ibm: Avoid uninitialized variable reference

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>
Dan Carpenter 9 年之前
父节点
当前提交
4d88d5a7bf
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/pci/hotplug/acpiphp_ibm.c

+ 2 - 0
drivers/pci/hotplug/acpiphp_ibm.c

@@ -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;