summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-11-15 12:57:27 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2013-11-15 12:57:27 +0100
commitdc96b68a826a652d514f994d1f7932fb6fff87a7 (patch)
tree553162f83f139f4e31f12ddc17c909974214c48f
parente4e5c29fb254a05a134886ee6518e3d7cfde1cc6 (diff)
mach-defpager: fix the page offsets returned by pager_pages
Previously the increment was outside the loop body, turning it into a dead increment. Move the increment into the loop body as it is done in the true branch above. This fixes the offsets recorded in the default_pager_page_t objects. Found using the Clang Static Analyzer. * mach-defpager/default_pager.c (pager_pages): Fix returned page offsets.
-rw-r--r--mach-defpager/default_pager.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index 8e466f72..a65a5fe1 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -879,12 +879,13 @@ pager_pages(pager, pages, numpages)
offset += vm_page_size;
}
} else {
- for (emap = &map[size]; map < emap; map++)
+ for (emap = &map[size]; map < emap; map++) {
if ( ! no_block(*map) ) {
if (actual++ < numpages)
pages++->dpp_offset = offset;
}
- offset += vm_page_size;
+ offset += vm_page_size;
+ }
}
return actual;
}