Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm Fix a thinko which could cause a NULL pointer deref, ...



details:   https://anonhg.NetBSD.org/src/rev/88d51d0da8b5
branches:  trunk
changeset: 474466:88d51d0da8b5
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jul 07 21:51:35 1999 +0000

description:
Fix a thinko which could cause a NULL pointer deref, in the PGO_FREE
case.

diffstat:

 sys/uvm/uvm_map.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (35 lines):

diff -r 66aafa4967b4 -r 88d51d0da8b5 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Wed Jul 07 21:29:29 1999 +0000
+++ b/sys/uvm/uvm_map.c Wed Jul 07 21:51:35 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_map.c,v 1.62 1999/07/07 21:04:22 thorpej Exp $     */
+/*     $NetBSD: uvm_map.c,v 1.63 1999/07/07 21:51:35 thorpej Exp $     */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -2460,6 +2460,12 @@
 
                        simple_lock(&anon->an_lock);
 
+                       pg = anon->u.an_page;
+                       if (pg == NULL) {
+                               simple_unlock(&anon->an_lock);
+                               continue;
+                       }
+
                        switch (flags & (PGO_CLEANIT|PGO_FREE|PGO_DEACTIVATE)) {
                        /*
                         * XXX In these first 3 cases, we always just
@@ -2470,12 +2476,6 @@
                        case PGO_CLEANIT|PGO_FREE:
                        case PGO_CLEANIT|PGO_DEACTIVATE:
                        case PGO_DEACTIVATE:
-                               pg = anon->u.an_page;
-                               if (pg == NULL) {
-                                       simple_unlock(&anon->an_lock);
-                                       continue;
-                               }
-
                                /* skip the page if it's loaned or wired */
                                if (pg->loan_count != 0 ||
                                    pg->wire_count != 0) {



Home | Main Index | Thread Index | Old Index