linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: akpm@osdl.org
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, buytenh@wantstofly.org
Subject: [patch 146/198] pci enumeration on ixp2000: overflow in kernel/resource.c
Date: Tue, 12 Apr 2005 03:32:51 -0700	[thread overview]
Message-ID: <200504121032.j3CAWwfR005732@shell0.pdx.osdl.net> (raw)


From: Lennert Buytenhek <buytenh@wantstofly.org>

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.

(akpm: pls. double-check)

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/kernel/resource.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN kernel/resource.c~pci-enumeration-on-ixp2000-overflow-in-kernel-resourcec kernel/resource.c
--- 25/kernel/resource.c~pci-enumeration-on-ixp2000-overflow-in-kernel-resourcec	2005-04-12 03:21:38.435293848 -0700
+++ 25-akpm/kernel/resource.c	2005-04-12 03:21:38.438293392 -0700
@@ -266,7 +266,7 @@ static int find_resource(struct resource
 		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;
 		}
_

                 reply	other threads:[~2005-04-12 11:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200504121032.j3CAWwfR005732@shell0.pdx.osdl.net \
    --to=akpm@osdl.org \
    --cc=buytenh@wantstofly.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).