kernel - Fix bug (not reached in normal operation) in vm_map_set_wired_quick()
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 10 Dec 2012 22:37:28 +0000 (14:37 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 14 Dec 2012 03:14:21 +0000 (19:14 -0800)
* Fix a bug where vm_map_set_wired_quick() only operated on the first
  vm_map_entry of a slab, and would panic if there were more.

* Slab allocations are only going to have one vm_map_entry anyway so the
  bug was never hit.  But we fix it anyway.

sys/vm/vm_map.c

index 7353a2a..9db4855 100644 (file)
@@ -2487,8 +2487,8 @@ vm_map_set_wired_quick(vm_map_t map, vm_offset_t addr, vm_size_t size,
        for (scan = entry;
             scan != &map->header && scan->start < addr + size;
             scan = scan->next) {
-           KKASSERT(entry->wired_count == 0);
-           entry->wired_count = 1;                                              
+           KKASSERT(scan->wired_count == 0);
+           scan->wired_count = 1;
        }
        vm_map_unclip_range(map, entry, addr, addr + size,
                            countp, MAP_CLIP_NO_HOLES);