From 765b758e372594a3cb4ca3d765f4a1c6a0dbfd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= Date: Tue, 17 Oct 2023 14:27:44 +0200 Subject: [PATCH] mm/validate: migrate all pages in bitmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/mm/validate.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mm/validate.rs b/src/mm/validate.rs index 10292f6d0..4cc37f93d 100644 --- a/src/mm/validate.rs +++ b/src/mm/validate.rs @@ -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);