[PATCH] fix kmalloc(0) in arch/ia64/pci/pci.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix following kmalloc(0) message. patch is agaisnt 2.6.22-rc1-mm1.

==
BUG: at mm/slab.c:792 __find_general_cachep()

Call Trace:
 [<a000000100013f20>] show_stack+0x40/0xa0
                                sp=e000014042227b00 bsp=e000014042220f90
 [<a000000100013fb0>] dump_stack+0x30/0x60
                                sp=e000014042227cd0 bsp=e000014042220f78
 [<a00000010014fe10>] kmem_find_general_cachep+0x90/0x140
                                sp=e000014042227cd0 bsp=e000014042220f48
 [<a0000001001504f0>] __kmalloc_node+0x30/0xa0
                                sp=e000014042227cd0 bsp=e000014042220f18
 [<a0000001004eb700>] pci_acpi_scan_root+0x180/0x4a0
                                sp=e000014042227cd0 bsp=e000014042220ed0
 [<a000000100361140>] acpi_pci_root_add+0x4e0/0x700
                                sp=e000014042227cf0 bsp=e000014042220e90
 [<a00000010035b240>] acpi_device_probe+0xa0/0x160
                                sp=e000014042227d10 bsp=e000014042220e58
 [<a0000001003e4550>] driver_probe_device+0x250/0x380
                                sp=e000014042227d10 bsp=e000014042220e18
 [<a0000001003e4900>] __driver_attach+0xc0/0x160
                                sp=e000014042227d10 bsp=e000014042220de0
 [<a0000001003e2980>] bus_for_each_dev+0x80/0x100
                                sp=e000014042227d10 bsp=e000014042220da8
 [<a0000001003e4120>] driver_attach+0x40/0x60
                                sp=e000014042227d30 bsp=e000014042220d88
 [<a0000001003e3170>] bus_add_driver+0xf0/0x3c0
                                sp=e000014042227d30 bsp=e000014042220d48
 [<a0000001003e4e00>] driver_register+0x140/0x160
                                sp=e000014042227d30 bsp=e000014042220d28
 [<a00000010035ded0>] acpi_bus_register_driver+0x50/0x80
                                sp=e000014042227d30 bsp=e000014042220d08
 [<a0000001007d6000>] acpi_pci_root_init+0x20/0x60
                                sp=e000014042227d30 bsp=e000014042220cf0
 [<a0000001007a46b0>] kernel_init+0x450/0x7c0
                                sp=e000014042227d30 bsp=e000014042220ca8
 [<a000000100012550>] kernel_thread_helper+0x30/0x60
                                sp=e000014042227e30 bsp=e000014042220c80
 [<a0000001000090c0>] start_kernel_thread+0x20/0x40
                                sp=e000014042227e30 bsp=e000014042220c80
==

Fix kmalloc(0)

Signed-Off-By: KAMEZAWA Hiroyuki <[email protected]>

Index: linux-2.6.22-rc1-mm1/arch/ia64/pci/pci.c
===================================================================
--- linux-2.6.22-rc1-mm1.orig/arch/ia64/pci/pci.c
+++ linux-2.6.22-rc1-mm1/arch/ia64/pci/pci.c
@@ -354,6 +354,8 @@ pci_acpi_scan_root(struct acpi_device *d
 
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
 			&windows);
+	if (!windows)
+		goto out2;
 	controller->window = kmalloc_node(sizeof(*controller->window) * windows,
 			GFP_KERNEL, controller->node);
 	if (!controller->window)



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux