2003-11-30 19:00:47

by Brad House

[permalink] [raw]
Subject: [PATCH 2.6.0-test11] agpgart [amd64] fix (off by one)

AGPGart would report "Too many northbridges" without this
patch. The problem was that 'i' was incremented before being
checked against the MAX GARTS, just making the check > instead
of == fixes the problems. Patch here:

http://dev.gentoo.org/~brad_mssw/kernel_patches/2.6.0/genpatches-0.7/101_amd64_agpgart_fix.patch


Also inlined below.
Please CC me on any replies

-Brad House
[email protected]


diff -ruN linux-2.6.0-test11.old/drivers/char/agp/amd64-agp.c
linux-2.6.0-test11/drivers/char/agp/amd64-agp.c
--- linux-2.6.0-test11.old/drivers/char/agp/amd64-agp.c 2003-11-26
15:44:44.000000000 -0500
+++ linux-2.6.0-test11/drivers/char/agp/amd64-agp.c 2003-11-30
14:07:38.690330488 -0500
@@ -357,7 +357,7 @@
}
hammers[i++] = loop_dev;
nr_garts = i;
- if (i == MAX_HAMMER_GARTS) {
+ if (nr_garts > MAX_HAMMER_GARTS) {
printk(KERN_INFO PFX "Too many northbridges for AGP\n");
return -1;
}




2003-11-30 21:37:29

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH 2.6.0-test11] agpgart [amd64] fix (off by one)

On Sun, Nov 30, 2003 at 02:14:54PM -0500, Brad House wrote:
> AGPGart would report "Too many northbridges" without this
> patch. The problem was that 'i' was incremented before being
> checked against the MAX GARTS, just making the check > instead
> of == fixes the problems. Patch here:

Already fixed slightly differently in agpgart bitkeeper tree.
I've been trying to get Linus to take this and a few other
similar bits for a while, but they just haven't been
important enough I guess, so its probably post 2.6.0 material.

Dave