diff options
author | 2018-04-10 12:27:01 +0000 | |
---|---|---|
committer | 2018-04-10 12:27:01 +0000 | |
commit | a70e45a62660026e1117c3c8fc6f9d33a0cec06e (patch) | |
tree | 3b8a3d1da73d25ef23bcefeee09be4ac021d5109 | |
parent | A couple of fixes to the : form of SGR. Apparently there is an extra (diff) | |
download | wireguard-openbsd-a70e45a62660026e1117c3c8fc6f9d33a0cec06e.tar.xz wireguard-openbsd-a70e45a62660026e1117c3c8fc6f9d33a0cec06e.zip |
Fix stop condition for linear search by taking into account the search
direction, otherwise we might break the loop prematurely; ok stefan@
-rw-r--r-- | sys/uvm/uvm_addr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/uvm/uvm_addr.c b/sys/uvm/uvm_addr.c index 896aee70a05..aa2f2e27459 100644 --- a/sys/uvm/uvm_addr.c +++ b/sys/uvm/uvm_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_addr.c,v 1.24 2017/01/23 01:10:10 patrick Exp $ */ +/* $OpenBSD: uvm_addr.c,v 1.25 2018/04/10 12:27:01 otto Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -358,8 +358,8 @@ uvm_addr_linsearch(struct vm_map *map, struct uvm_addr_state *uaddr, entry = (direction == 1 ? RBT_NEXT(uvm_map_addr, entry) : RBT_PREV(uvm_map_addr, entry))) { - if (VMMAP_FREE_START(entry) > high || - VMMAP_FREE_END(entry) < low) { + if ((direction == 1 && VMMAP_FREE_START(entry) > high) || + (direction == -1 && VMMAP_FREE_END(entry) < low)) { break; } |