Skip to contentSkip to conversation

pci enumeration on ixp2000: overflow in kernel/resource.c

PATCH New Lennert Buytenhek 1 participant 1 message Apr 9, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci enumeration on ixp2000: overflow in kernel/resource.c

(please CC, not on the list)

Hi all,

IXP2000 (ARM-based) platforms use a separate 'struct resource' for PCI MEM space. Resource allocation for PCI BARs always fails because the 'root' resource (the IXP2000 PCI MEM resource) always has the entire address space (00000000-ffffffff) free, and find_resource() calculates the size of that range as ffffffff-00000000+1=0, so all allocations fail because it thinks there is no space.

Comments? Can find_resource ever be called with size=0?

cheers,
Lennert

kernel/resource.c +1 -1
diff -urN linux-2.6.11.orig/kernel/resource.c linux-2.6.11/kernel/resource.c
@@ -266,7 +266,7 @@
 		new->start = (new->start + align - 1) & ~(align - 1);
 		if (alignf)
 			alignf(alignf_data, new, size, align);
-		if (new->start < new->end && new->end - new->start + 1 >= size) {
+		if (new->start < new->end && new->end - new->start >= size - 1) {
 			new->end = new->start + size - 1;
 			return 0;
 		}