From dc96b68a826a652d514f994d1f7932fb6fff87a7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Fri, 15 Nov 2013 12:57:27 +0100 Subject: 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. --- mach-defpager/default_pager.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mach-defpager') 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; } -- cgit v1.2.3