diff --git a/sys/fs/procfs/procfs_map.c b/sys/fs/procfs/procfs_map.c --- a/sys/fs/procfs/procfs_map.c +++ b/sys/fs/procfs/procfs_map.c @@ -84,7 +84,7 @@ struct vnode *vp; char *fullpath, *freepath, *type; struct ucred *cred; - vm_object_t obj, tobj, lobj; + vm_object_t lobj, nobj, obj, tobj; int error, privateresident, ref_count, resident, shadow_count, flags; vm_offset_t e_start, e_end; vm_eflags_t e_eflags; @@ -144,7 +144,8 @@ } if (obj != NULL) kern_proc_vmmap_resident(map, entry, &resident, &super); - for (tobj = obj; tobj != NULL; tobj = tobj->backing_object) { + for (tobj = obj; tobj != NULL; tobj = nobj) { + nobj = tobj->backing_object; if (tobj != obj && tobj != lobj) VM_OBJECT_RUNLOCK(tobj); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2505,7 +2505,7 @@ vm_map_entry_t entry, tmp_entry; struct vattr va; vm_map_t map; - vm_object_t obj, tobj, lobj; + vm_object_t lobj, nobj, obj, tobj; char *fullpath, *freepath; struct kinfo_vmentry *kve; struct ucred *cred; @@ -2551,8 +2551,8 @@ &kve->kve_resident, &super); if (super) kve->kve_flags |= KVME_FLAG_SUPER; - for (tobj = obj; tobj != NULL; - tobj = tobj->backing_object) { + for (tobj = obj; tobj != NULL; tobj = nobj) { + nobj = tobj->backing_object; if (tobj != obj && tobj != lobj) VM_OBJECT_RUNLOCK(tobj); }