Skip to content

Commit

Permalink
[IA64] fix kmalloc(0) in arch/ia64/pci/pci.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kenji Kaneshige authored and Tony Luck committed May 22, 2007
1 parent 6ae3848 commit a66aa70
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/ia64/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,13 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)

acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
&windows);
controller->window = kmalloc_node(sizeof(*controller->window) * windows,
GFP_KERNEL, controller->node);
if (!controller->window)
goto out2;
if (windows) {
controller->window =
kmalloc_node(sizeof(*controller->window) * windows,
GFP_KERNEL, controller->node);
if (!controller->window)
goto out2;
}

name = kmalloc(16, GFP_KERNEL);
if (!name)
Expand Down

0 comments on commit a66aa70

Please sign in to comment.