summaryrefslogtreecommitdiffstats
path: root/sys/vm/memguard.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-08-10 17:36:42 +0000
committerkib <kib@FreeBSD.org>2013-08-10 17:36:42 +0000
commit4675fcfce0ca7178b334ea67fe2d3ab745477a95 (patch)
tree2ae4177fdf8f77bdbf75571d149fb9e54db96bda /sys/vm/memguard.c
parent29e6d17ad1d88a5156b4c44ff927a4ae7be2c279 (diff)
downloadFreeBSD-src-4675fcfce0ca7178b334ea67fe2d3ab745477a95.zip
FreeBSD-src-4675fcfce0ca7178b334ea67fe2d3ab745477a95.tar.gz
Different consumers of the struct vm_page abuse pageq member to keep
additional information, when the page is guaranteed to not belong to a paging queue. Usually, this results in a lot of type casts which make reasoning about the code correctness harder. Sometimes m->object is used instead of pageq, which could cause real and confusing bugs if non-NULL m->object is leaked. See r141955 and r253140 for examples. Change the pageq member into a union containing explicitly-typed members. Use them instead of type-punning or abusing m->object in x86 pmaps, uma and vm_page_alloc_contig(). Requested and reviewed by: alc Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/vm/memguard.c')
-rw-r--r--sys/vm/memguard.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/vm/memguard.c b/sys/vm/memguard.c
index ea2d925..8b02161 100644
--- a/sys/vm/memguard.c
+++ b/sys/vm/memguard.c
@@ -261,7 +261,7 @@ v2sizep(vm_offset_t va)
p = PHYS_TO_VM_PAGE(pa);
KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
- return ((u_long *)&p->pageq.tqe_next);
+ return (&p->plinks.memguard.p);
}
static u_long *
@@ -276,7 +276,7 @@ v2sizev(vm_offset_t va)
p = PHYS_TO_VM_PAGE(pa);
KASSERT(p->wire_count != 0 && p->queue == PQ_NONE,
("MEMGUARD: Expected wired page %p in vtomgfifo!", p));
- return ((u_long *)&p->pageq.tqe_prev);
+ return (&p->plinks.memguard.v);
}
/*
OpenPOWER on IntegriCloud