aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2007-05-22 13:20:36 -0400
committerTony Luck <tony.luck@intel.com>2007-05-22 13:20:36 -0400
commita66aa704d6f332b001dfb0e787c92b2c61c75081 (patch)
tree41871a0f1da59f8033700c0c613150d03ad36fcd
parent6ae384884d936cb39ab20238af34689933e44525 (diff)
[IA64] fix kmalloc(0) in arch/ia64/pci/pci.c
Hiroyuki Kamezawa reported the problem that pci_acpi_scan_root() of ia64 might call kmalloc_node() with zero size. Currently ia64's pci_acpi_scan_root() assumes that _CRS method of root bridge has at least one resource window. But, the root bridges that has no resource window must be taken into account. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/pci/pci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 3549f3b42592..73696b4a2eed 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -354,10 +354,13 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
354 354
355 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 355 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
356 &windows); 356 &windows);
357 controller->window = kmalloc_node(sizeof(*controller->window) * windows, 357 if (windows) {
358 GFP_KERNEL, controller->node); 358 controller->window =
359 if (!controller->window) 359 kmalloc_node(sizeof(*controller->window) * windows,
360 goto out2; 360 GFP_KERNEL, controller->node);
361 if (!controller->window)
362 goto out2;
363 }
361 364
362 name = kmalloc(16, GFP_KERNEL); 365 name = kmalloc(16, GFP_KERNEL);
363 if (!name) 366 if (!name)