[PATCH 2.6.11-mm1] acpiphp_ibm: add failure handling for memory allocation

From: Panagiotis Issaris
Date: Sun Mar 06 2005 - 14:01:47 EST


Hi,

This patch adds failure handling for kmalloc in the ACPI PCI Hot Plug IBM
Extension driver.

Signed-off-by: <panagiotis.issaris@xxxxxxxxxxxxxxxxxxx>

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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/