Hi,
This patch adds failure handling for kmalloc in the ACPI PCI Hot Plug IBM
Extension driver.
Signed-off-by: <[email protected]>
diff -pruN linux-2.6.11-orig/drivers/pci/hotplug/acpiphp_ibm.c linux-2.6.11-pi/drivers/pci/hotplug/acpiphp_ibm.c
--- linux-2.6.11-orig/drivers/pci/hotplug/acpiphp_ibm.c 2005-03-05 03:38:06.000000000 +0100
+++ linux-2.6.11-pi/drivers/pci/hotplug/acpiphp_ibm.c 2005-03-06 19:35:06.000000000 +0100
@@ -163,6 +163,11 @@ static union apci_descriptor *ibm_slot_f
ibm_slot_done:
if (ret) {
ret = kmalloc(sizeof(union apci_descriptor), GFP_KERNEL);
+ if (!ret) {
+ err("%s: Memory allocation failed.\n", __FUNCTION__);
+ kfree(table);
+ return -ENOMEM;
+ }
memcpy(ret, des, sizeof(union apci_descriptor));
}
kfree(table);