summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_aobj.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-10-27 18:05:17 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-10-27 18:05:17 +0000
commit5cc720499c9d1d773fc5c2f8b5199cb67c980c1e (patch)
tree42ec519f0435b5e6d95f1be9f1fc9b85479beba3 /sys/uvm/uvm_aobj.c
parentfc1d5cfef8dfe275a51acb19b1ac626096f86356 (diff)
Following a next pointer of an element deleted from a list is bad
practise. Depending on the list implementation, this might or might not work; so make it use a safe idiom. ok pedro@ millert@ deraadt@
Diffstat (limited to 'sys/uvm/uvm_aobj.c')
-rw-r--r--sys/uvm/uvm_aobj.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index b0ec463b8e3..be72e9abae6 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.27 2004/12/26 21:22:14 miod Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.28 2005/10/27 18:05:16 otto Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -658,7 +658,7 @@ uao_detach_locked(uobj)
struct uvm_object *uobj;
{
struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- struct vm_page *pg;
+ struct vm_page *pg, *next;
boolean_t busybody;
UVMHIST_FUNC("uao_detach"); UVMHIST_CALLED(maphist);
@@ -690,9 +690,8 @@ uao_detach_locked(uobj)
* mark for release any that are.
*/
busybody = FALSE;
- for (pg = TAILQ_FIRST(&uobj->memq);
- pg != NULL;
- pg = TAILQ_NEXT(pg, listq)) {
+ for (pg = TAILQ_FIRST(&uobj->memq); pg != NULL; pg = next) {
+ next = TAILQ_NEXT(pg, listq);
if (pg->flags & PG_BUSY) {
pg->flags |= PG_RELEASED;
busybody = TRUE;