[PATCH] [2.4] AGPGART maximum memory computed incorrectly

From: Marcelo E. Magallon (mmagallo@debian.org)
Date: Wed Jul 30 2003 - 09:07:22 EST


Hi,

 the following patch fixes a problem that shows up on machines with 4GB
 of physical RAM. The operation num_physpages << PAGE_SHIFT overflows
 and the maximum memory is reported as 0. Please apply before releasing
 2.4.22.

 Thanks,

 Marcelo

--- linux-2.4.22-pre6-ac1+p4+4gb/drivers/char/agp/agpgart_be.c.orig 2003-07-30 12:26:18.000000000 +0200
+++ linux-2.4.22-pre6-ac1+p4+4gb/drivers/char/agp/agpgart_be.c 2003-07-30 12:29:03.000000000 +0200
@@ -5655,7 +5655,11 @@
 {
         long memory, index, result;
 
- memory = (num_physpages << PAGE_SHIFT) >> 20;
+#if PAGE_SHIFT < 20
+ memory = num_physpages >> (20 - PAGE_SHIFT);
+#else
+ memory = num_physpages << (PAGE_SHIFT - 20);
+#endif
         index = 1;
 
         while ((memory > maxes_table[index].mem) &&
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:45 EST