Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips cpu_uarea_alloc: For ILP32, do not try to...



details:   https://anonhg.NetBSD.org/src/rev/2a1eb0352e32
branches:  trunk
changeset: 989488:2a1eb0352e32
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Oct 14 02:22:25 2021 +0000

description:
cpu_uarea_alloc: For ILP32, do not try to allocate physical memory above
pmap_limits.avail_end.

Fix NULL dereference in uvm_pglistalloc_contig_aggressive().

diffstat:

 sys/arch/mips/mips/vm_machdep.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r f0cb95d34eb4 -r 2a1eb0352e32 sys/arch/mips/mips/vm_machdep.c
--- a/sys/arch/mips/mips/vm_machdep.c   Wed Oct 13 23:33:52 2021 +0000
+++ b/sys/arch/mips/mips/vm_machdep.c   Thu Oct 14 02:22:25 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.162 2020/08/23 10:23:38 simonb Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.163 2021/10/14 02:22:25 rin Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.162 2020/08/23 10:23:38 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.163 2021/10/14 02:22:25 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -176,15 +176,13 @@
 #ifdef PMAP_MAP_POOLPAGE
 
        struct pglist pglist;
-#ifdef _LP64
        const paddr_t high = pmap_limits.avail_end;
-#else
-       const paddr_t high = MIPS_KSEG1_START - MIPS_KSEG0_START;
+#ifndef _LP64
        /*
         * Don't allocate a direct mapped uarea if we aren't allocating for a
         * system lwp and we have memory that can't be mapped via KSEG0.
         */
-       if (!system && high < pmap_limits.avail_end)
+       if (!system && high > MIPS_KSEG1_START - MIPS_KSEG0_START)
                return NULL;
 #endif
        int error;



Home | Main Index | Thread Index | Old Index