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

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

 



(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


diff -urN linux-2.6.11.orig/kernel/resource.c linux-2.6.11/kernel/resource.c
--- linux-2.6.11.orig/kernel/resource.c	2005-03-02 08:38:13.000000000 +0100
+++ linux-2.6.11/kernel/resource.c	2005-04-07 11:58:26.000000000 +0200
@@ -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;
 		}


-
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