linux-mips
[Top] [All Lists]

[PATCH 1/1] MIPS: Fix "max_mapnr" assignment bug

To: <linux-mips@linux-mips.org>
Subject: [PATCH 1/1] MIPS: Fix "max_mapnr" assignment bug
From: "Williams, Victor L." <WilliaVi@cisco.com>
Date: Wed, 13 Aug 2008 15:21:37 -0400
Authentication-results: sj-dkim-2; header.From=WilliaVi@cisco.com; dkim=pass ( sig from cisco.com/sjdkim2002 verified; );
Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; l=7157; t=1218655296; x=1219519296; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=WilliaVi@cisco.com; z=From:=20=22Williams,=20Victor=20L.=22=20<WilliaVi@cisco.co m> |Subject:=20[PATCH=201/1]=20MIPS=3A=20Fix=20=22max_mapnr=22 =20assignment=20bug |Sender:=20; bh=mhvRol7ohYMYDVd50x/sHrDZCVv88scQ0CnBgU+iLEs=; b=WofDlR3rZQCYbE8gMqP62KDxhpSs8y97N5gxZFtdAtHOblf1/Xg5q2MkZO 9rxZEEkqKBTQoMOQJtwg6U6D2uTVNTBQ4awDZQHkMVc6XC4+OFMz14JuQi9I 5rFA8s/p9I;
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Thread-index: Acj9ec5SbgKHBAQgQEiMCICYlIRLGg==
Thread-topic: [PATCH 1/1] MIPS: Fix "max_mapnr" assignment bug

Fix "max_mapnr" assignment bug for high-memory enabled kernels running on
platforms with no high memory

Currently, high memory enabled kernels always set "max_mapnr" equal to
"highend_pfn", but "highend_pfn" is only valid if high memory is available on
the platform.  The proposed fix is to only use "highend_pfn" in the assignment
when it is valid (non-zero).  In my particular case, this bug was manifesting
itself via the "pfn_valid()" macro, with "CONFIG_FLATMEM" defined.

Signed-off-by: Victor Williams <williavi@cisco.com>
Signed-off-by: Sudharsan Vijayaraghavan <vijayas@cisco.com>
---

 init.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- old/arch/mips/mm/init.c     2008-08-06 11:19:01.000000000 -0500
+++ new/arch/mips/mm/init.c     2008-08-13 11:17:03.000000000 -0500
@@ -388,13 +388,13 @@
        unsigned long codesize, reservedpages, datasize, initsize;
        unsigned long tmp, ram;

+       max_mapnr = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
 #ifdef CONFIG_DISCONTIGMEM
 #error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
 #endif
-       max_mapnr = highend_pfn;
-#else
-       max_mapnr = max_low_pfn;
+       if (highend_pfn)
+          max_mapnr = highend_pfn;
 #endif
        high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);


      - - - - -                              Cisco                             - - - - -         
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.
<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 1/1] MIPS: Fix "max_mapnr" assignment bug, Williams, Victor L. <=