summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-02-20 20:16:24 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-02-20 20:16:24 +0000
commitacd9fb5b95c8ecd6460e9b160c49fd8f8918d12b (patch)
tree03ad1f4a009469b5011762170617a712d8ecef63 /sys/uvm
parent4bc7467c1b8f07253aa5d3cd1a7ff84886abf14b (diff)
merging ppref could cause negative back reference, fix from niklas@
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_amap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c
index de6bea7db3e..6bb844233e9 100644
--- a/sys/uvm/uvm_amap.c
+++ b/sys/uvm/uvm_amap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_amap.c,v 1.23 2002/02/19 17:57:34 provos Exp $ */
+/* $OpenBSD: uvm_amap.c,v 1.24 2002/02/20 20:16:23 provos Exp $ */
/* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -954,7 +954,8 @@ amap_pp_adjref(amap, curslot, slotlen, adjval)
}
prevlcv = lcv;
}
- pp_getreflen(ppref, prevlcv, &prevref, &prevlen);
+ if (prevlcv >= 0)
+ pp_getreflen(ppref, prevlcv, &prevref, &prevlen);
/*
* now adjust reference counts in range. merge the first
@@ -975,7 +976,8 @@ amap_pp_adjref(amap, curslot, slotlen, adjval)
ref += adjval;
if (ref < 0)
panic("amap_pp_adjref: negative reference count");
- if (lcv == prevlcv + prevlen && ref == prevref) {
+ if (prevlcv >= 0 && lcv == prevlcv + prevlen &&
+ ref == prevref) {
pp_setreflen(ppref, prevlcv, ref, prevlen + len);
} else {
pp_setreflen(ppref, lcv, ref, len);