Consistently use for-loops in vm_map_protect().
No functional change. Reviewed by: kib MFC after: 1 week Sponsored by: Dell EMC Isilon X-Differential Revision: https://reviews.freebsd.org/D10349
This commit is contained in:
parent
ed11e4d701
commit
1c2d20a1d0
@ -1976,8 +1976,8 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
|
||||
/*
|
||||
* Make a first pass to check for protection violations.
|
||||
*/
|
||||
current = entry;
|
||||
while ((current != &map->header) && (current->start < end)) {
|
||||
for (current = entry; current != &map->header && current->start < end;
|
||||
current = current->next) {
|
||||
if (current->eflags & MAP_ENTRY_IS_SUB_MAP) {
|
||||
vm_map_unlock(map);
|
||||
return (KERN_INVALID_ARGUMENT);
|
||||
@ -1986,17 +1986,15 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
|
||||
vm_map_unlock(map);
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Do an accounting pass for private read-only mappings that
|
||||
* now will do cow due to allowed write (e.g. debugger sets
|
||||
* breakpoint on text segment)
|
||||
*/
|
||||
for (current = entry; (current != &map->header) &&
|
||||
(current->start < end); current = current->next) {
|
||||
for (current = entry; current != &map->header && current->start < end;
|
||||
current = current->next) {
|
||||
|
||||
vm_map_clip_end(map, current, end);
|
||||
|
||||
@ -2049,8 +2047,8 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
|
||||
* Go back and fix up protections. [Note that clipping is not
|
||||
* necessary the second time.]
|
||||
*/
|
||||
current = entry;
|
||||
while ((current != &map->header) && (current->start < end)) {
|
||||
for (current = entry; current != &map->header && current->start < end;
|
||||
current = current->next) {
|
||||
old_prot = current->protection;
|
||||
|
||||
if (set_max)
|
||||
@ -2084,7 +2082,6 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_offset_t end,
|
||||
#undef MASK
|
||||
}
|
||||
vm_map_simplify_entry(map, current);
|
||||
current = current->next;
|
||||
}
|
||||
vm_map_unlock(map);
|
||||
return (KERN_SUCCESS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user