From d643f42a862940f1162dd0fefaedaa717aec662e Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Thu, 9 May 2002 14:14:19 +0000 Subject: from netbsd; okay art@ revision 1.43 date: 2002/03/28 06:06:29; author: nathanw; state: Exp; lines: +13 -3 In amap_pp_adjref(), avoid incorrectly merging the first two chunks in a ppref array when the range being adjusted includes the beginning of the array. --- sys/uvm/uvm_amap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sys/uvm/uvm_amap.c') diff --git a/sys/uvm/uvm_amap.c b/sys/uvm/uvm_amap.c index 9917dcabb74..967d984823e 100644 --- a/sys/uvm/uvm_amap.c +++ b/sys/uvm/uvm_amap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_amap.c,v 1.26 2002/03/14 01:27:18 millert Exp $ */ +/* $OpenBSD: uvm_amap.c,v 1.27 2002/05/09 14:14:18 provos Exp $ */ /* $NetBSD: uvm_amap.c,v 1.27 2000/11/25 06:27:59 chs Exp $ */ /* @@ -954,7 +954,17 @@ amap_pp_adjref(amap, curslot, slotlen, adjval) } prevlcv = lcv; } - pp_getreflen(ppref, prevlcv, &prevref, &prevlen); + if (lcv != 0) + pp_getreflen(ppref, prevlcv, &prevref, &prevlen); + else { + /* Ensure that the "prevref == ref" test below always + * fails, since we're starting from the beginning of + * the ppref array; that is, there is no previous + * chunk. + */ + prevref = -1; + prevlen = 0; + } /* * now adjust reference counts in range. merge the first -- cgit v1.2.3