Skip to content

Commit

Permalink
mm/validate: migrate all pages in bitmap
Browse files Browse the repository at this point in the history
If the number of pages in the bitmap was not a multiple of 64, the
remainder would not be copied over to the new bitmap during
migration, which could lead to tracking validated pages as invalid.

Signed-off-by: Carlos López <carlos.lopez@suse.com>
  • Loading branch information
00xc committed Oct 17, 2023
1 parent 7eb6d6d commit 765b758
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mm/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ impl ValidBitmap {
}

fn migrate(&mut self, new_bitmap: *mut u64) {
let (count, _) = self.index(self.pend);
let (mut count, bit) = self.index(self.pend);
if bit != 0 {
count += 1;
}

unsafe {
ptr::copy_nonoverlapping(self.bitmap, new_bitmap, count as usize);
Expand Down

0 comments on commit 765b758

Please sign in to comment.