Skip to contentSkip to conversation

PCI: acpiphp_ibm: potential uninitialized variable bug

PATCH Applied Dan Carpenter 2 participants 2 messages Apr 15, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: acpiphp_ibm: potential uninitialized variable bug

If ibm_get_table_from_acpi() fails then "table" isn't initialized. I fixed this by adding a check for failure.

drivers/pci/hotplug/acpiphp_ibm.c +2 -0
index 2f6d3a1..f6221d7 100644
@@ -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;
#1 lore raw
Quoted 4 lines · Dan Carpenter

If ibm_get_table_from_acpi() fails then "table" isn't initialized. I fixed this by adding a check for failure.

Applied to pci/hotplug for v4.7, thanks, Dan!

Quoted 17 lines
drivers/pci/hotplug/acpiphp_ibm.c +2 -1
index 2f6d3a1..f6221d7 100644
@@ -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;
--

To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html