summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_swap.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-12-02 01:52:33 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-12-02 01:52:33 +0000
commitdb58e6d0bcbbec74a2b517e17c8a7808d50677a4 (patch)
tree785d398ccda45789b1ef15f957c7154502681cd1 /sys/uvm/uvm_swap.c
parent182ac72eb577cb48a3a2f111aede25a5cabfa02e (diff)
do not deref null ptr in uvm_markbad() returned from swapdrum_getsdp() as others callers do
Diffstat (limited to 'sys/uvm/uvm_swap.c')
-rw-r--r--sys/uvm/uvm_swap.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index afeb56a9c3f..856c5c7af24 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.56 2003/08/15 20:32:21 tedu Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.57 2003/12/02 01:52:32 mickey Exp $ */
/* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */
/*
@@ -1660,16 +1660,16 @@ uvm_swap_markbad(startslot, nslots)
simple_lock(&uvm.swap_data_lock);
sdp = swapdrum_getsdp(startslot);
-
- /*
- * we just keep track of how many pages have been marked bad
- * in this device, to make everything add up in swap_off().
- * we assume here that the range of slots will all be within
- * one swap device.
- */
-
- sdp->swd_npgbad += nslots;
- UVMHIST_LOG(pdhist, "now %d bad", sdp->swd_npgbad, 0,0,0);
+ if (sdp != NULL) {
+ /*
+ * we just keep track of how many pages have been marked bad
+ * in this device, to make everything add up in swap_off().
+ * we assume here that the range of slots will all be within
+ * one swap device.
+ */
+ sdp->swd_npgbad += nslots;
+ UVMHIST_LOG(pdhist, "now %d bad", sdp->swd_npgbad, 0,0,0);
+ }
simple_unlock(&uvm.swap_data_lock);
}