Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Avoid NPE.



details:   https://anonhg.NetBSD.org/src/rev/33f1b0706312
branches:  trunk
changeset: 828017:33f1b0706312
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 22 21:26:01 2017 +0000

description:
Avoid NPE.

diffstat:

 sys/arch/x86/x86/pmap.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 86f358f2017e -r 33f1b0706312 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Wed Nov 22 17:11:51 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Wed Nov 22 21:26:01 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.266 2017/11/20 20:57:58 chs Exp $   */
+/*     $NetBSD: pmap.c,v 1.267 2017/11/22 21:26:01 christos Exp $      */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.266 2017/11/20 20:57:58 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2017/11/22 21:26:01 christos Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1800,8 +1800,8 @@
         * since the first pv entry is stored in the pmap_page.
         */
 
-       return (pp->pp_flags & PP_EMBEDDED) != 0 ||
-               !LIST_EMPTY(&pp->pp_head.pvh_list);
+       return pp && ((pp->pp_flags & PP_EMBEDDED) != 0 ||
+           !LIST_EMPTY(&pp->pp_head.pvh_list));
 }
 
 /*
@@ -4181,7 +4181,7 @@
         */
 
        bool needpves = pmap_pp_needs_pve(new_pp);
-       if (new_pp && needpves) {
+       if (needpves) {
                new_pve = pool_cache_get(&pmap_pv_cache, PR_NOWAIT);
                new_sparepve = pool_cache_get(&pmap_pv_cache, PR_NOWAIT);
        } else {



Home | Main Index | Thread Index | Old Index