diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-11-06 11:52:40 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-11-06 11:52:40 +0000 |
commit | 582511428c84c67209fdc076be8b5be49c83bc11 (patch) | |
tree | 176c6c1d4f612ed9fa23ca3aac8b40a48b276cbc /sys/uvm | |
parent | 9fe867ef7e5b79dfbf6055572ffe97db26fe00d5 (diff) |
Remove unused `anon' argument from uvmfault_unlockall().
It won't be used when amap and anon locking will be introduced.
This "fixes" passing a unrelated/uninitialized pointer in an error path
in case of memory shortage.
ok kettenis@
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_device.c | 8 | ||||
-rw-r--r-- | sys/uvm/uvm_fault.c | 36 | ||||
-rw-r--r-- | sys/uvm/uvm_fault.h | 4 |
3 files changed, 23 insertions, 25 deletions
diff --git a/sys/uvm/uvm_device.c b/sys/uvm/uvm_device.c index 2d69e61ac4c..33452c43573 100644 --- a/sys/uvm/uvm_device.c +++ b/sys/uvm/uvm_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_device.c,v 1.59 2020/10/24 21:07:53 kettenis Exp $ */ +/* $OpenBSD: uvm_device.c,v 1.60 2020/11/06 11:52:39 mpi Exp $ */ /* $NetBSD: uvm_device.c,v 1.30 2000/11/25 06:27:59 chs Exp $ */ /* @@ -306,7 +306,7 @@ udv_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, int npages, * so we kill any attempt to do so here. */ if (UVM_ET_ISCOPYONWRITE(entry)) { - uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL); + uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj); return(VM_PAGER_ERROR); } @@ -354,7 +354,7 @@ udv_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, int npages, * XXX case. */ uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, - uobj, NULL); + uobj); /* sync what we have so far */ pmap_update(ufi->orig_map->pmap); @@ -363,7 +363,7 @@ udv_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps, int npages, } } - uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj, NULL); + uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj); pmap_update(ufi->orig_map->pmap); return (retval); } diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index cd9332431d4..cec22dfe250 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.c,v 1.103 2020/10/21 08:55:40 mpi Exp $ */ +/* $OpenBSD: uvm_fault.c,v 1.104 2020/11/06 11:52:39 mpi Exp $ */ /* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */ /* @@ -301,7 +301,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, * the last unlock must be an atomic unlock+wait on * the owner of page */ - uvmfault_unlockall(ufi, amap, NULL, NULL); + uvmfault_unlockall(ufi, amap, NULL); tsleep_nsec(pg, PVM, "anonget2", INFSLP); /* ready to relock and try again */ } else { @@ -309,14 +309,14 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, pg = uvm_pagealloc(NULL, 0, anon, 0); if (pg == NULL) { /* out of RAM. */ - uvmfault_unlockall(ufi, amap, NULL, anon); + uvmfault_unlockall(ufi, amap, NULL); uvmexp.fltnoram++; uvm_wait("flt_noram1"); /* ready to relock and try again */ } else { /* we set the PG_BUSY bit */ we_own = TRUE; - uvmfault_unlockall(ufi, amap, NULL, anon); + uvmfault_unlockall(ufi, amap, NULL); /* * we are passing a PG_BUSY+PG_FAKE+PG_CLEAN @@ -368,8 +368,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, pmap_page_protect(pg, PROT_NONE); uvm_anfree(anon); /* frees page for us */ if (locked) - uvmfault_unlockall(ufi, amap, NULL, - NULL); + uvmfault_unlockall(ufi, amap, NULL); uvmexp.fltpgrele++; return (VM_PAGER_REFAULT); /* refault! */ } @@ -399,8 +398,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, uvm_unlock_pageq(); if (locked) - uvmfault_unlockall(ufi, amap, NULL, - anon); + uvmfault_unlockall(ufi, amap, NULL); return (VM_PAGER_ERROR); } @@ -423,7 +421,7 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, amap_lookup(&ufi->entry->aref, ufi->orig_rvaddr - ufi->entry->start) != anon) { - uvmfault_unlockall(ufi, amap, NULL, anon); + uvmfault_unlockall(ufi, amap, NULL); return (VM_PAGER_REFAULT); } @@ -937,7 +935,7 @@ ReFault: /* check for out of RAM */ if (anon == NULL || pg == NULL) { - uvmfault_unlockall(&ufi, amap, NULL, oanon); + uvmfault_unlockall(&ufi, amap, NULL); if (anon == NULL) uvmexp.fltnoanon++; else { @@ -997,7 +995,7 @@ ReFault: * We do, however, have to go through the ReFault path, * as the map may change while we're asleep. */ - uvmfault_unlockall(&ufi, amap, NULL, oanon); + uvmfault_unlockall(&ufi, amap, NULL); if (uvm_swapisfull()) { /* XXX instrumentation */ return (ENOMEM); @@ -1028,7 +1026,7 @@ ReFault: uvm_unlock_pageq(); /* done case 1! finish up by unlocking everything and returning success */ - uvmfault_unlockall(&ufi, amap, NULL, oanon); + uvmfault_unlockall(&ufi, amap, NULL); pmap_update(ufi.orig_map->pmap); return (0); @@ -1065,7 +1063,7 @@ Case2: /* update rusage counters */ curproc->p_ru.ru_majflt++; - uvmfault_unlockall(&ufi, amap, NULL, NULL); + uvmfault_unlockall(&ufi, amap, NULL); uvmexp.fltget++; gotpages = 1; @@ -1100,7 +1098,7 @@ Case2: if (locked && amap && amap_lookup(&ufi.entry->aref, ufi.orig_rvaddr - ufi.entry->start)) { if (locked) - uvmfault_unlockall(&ufi, amap, NULL, NULL); + uvmfault_unlockall(&ufi, amap, NULL); locked = FALSE; } @@ -1191,7 +1189,7 @@ Case2: } /* unlock and fail ... */ - uvmfault_unlockall(&ufi, amap, uobj, NULL); + uvmfault_unlockall(&ufi, amap, uobj); if (anon == NULL) uvmexp.fltnoanon++; else { @@ -1244,7 +1242,7 @@ Case2: if (amap_add(&ufi.entry->aref, ufi.orig_rvaddr - ufi.entry->start, anon, 0)) { - uvmfault_unlockall(&ufi, amap, NULL, oanon); + uvmfault_unlockall(&ufi, amap, NULL); uvm_anfree(anon); uvmexp.fltnoamap++; @@ -1277,7 +1275,7 @@ Case2: atomic_clearbits_int(&pg->pg_flags, PG_BUSY|PG_FAKE|PG_WANTED); UVM_PAGE_OWN(pg, NULL); - uvmfault_unlockall(&ufi, amap, uobj, NULL); + uvmfault_unlockall(&ufi, amap, uobj); if (uvm_swapisfull()) { /* XXX instrumentation */ return (ENOMEM); @@ -1312,7 +1310,7 @@ Case2: atomic_clearbits_int(&pg->pg_flags, PG_BUSY|PG_FAKE|PG_WANTED); UVM_PAGE_OWN(pg, NULL); - uvmfault_unlockall(&ufi, amap, uobj, NULL); + uvmfault_unlockall(&ufi, amap, uobj); pmap_update(ufi.orig_map->pmap); return (0); @@ -1445,7 +1443,7 @@ uvmfault_unlockmaps(struct uvm_faultinfo *ufi, boolean_t write_locked) */ void uvmfault_unlockall(struct uvm_faultinfo *ufi, struct vm_amap *amap, - struct uvm_object *uobj, struct vm_anon *anon) + struct uvm_object *uobj) { uvmfault_unlockmaps(ufi, FALSE); diff --git a/sys/uvm/uvm_fault.h b/sys/uvm/uvm_fault.h index 12492d4f38c..cbeca0a483b 100644 --- a/sys/uvm/uvm_fault.h +++ b/sys/uvm/uvm_fault.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.h,v 1.15 2014/07/11 16:35:40 jsg Exp $ */ +/* $OpenBSD: uvm_fault.h,v 1.16 2020/11/06 11:52:39 mpi Exp $ */ /* $NetBSD: uvm_fault.h,v 1.14 2000/06/26 14:21:17 mrg Exp $ */ /* @@ -70,7 +70,7 @@ void uvmfault_init(void); boolean_t uvmfault_lookup(struct uvm_faultinfo *, boolean_t); boolean_t uvmfault_relock(struct uvm_faultinfo *); void uvmfault_unlockall(struct uvm_faultinfo *, struct vm_amap *, - struct uvm_object *, struct vm_anon *); + struct uvm_object *); int uvmfault_anonget(struct uvm_faultinfo *, struct vm_amap *, struct vm_anon *); |