From 0e21b56aeac10eb4a5facbdcb34ec68ee890b120 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 27 Jun 2025 18:22:09 -0400 Subject: [PATCH] pci: do not check for page-aligned size and offset before calling mmap() The kernel will validate that the size is page-aligned. The file offset is always zero, so the kernel will also validate that the offset is page-aligned. Signed-off-by: Demi Marie Obenour --- pci/src/vfio.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pci/src/vfio.rs b/pci/src/vfio.rs index a1c28c911..23efa8c3d 100644 --- a/pci/src/vfio.rs +++ b/pci/src/vfio.rs @@ -1650,17 +1650,6 @@ impl VfioPciDevice { self.common.interrupt.msix.as_ref(), )?; - for area in &sparse_areas { - if !is_page_size_aligned(area.size) || !is_page_size_aligned(area.offset) { - error!( - "Could not mmap sparse area that is not page size aligned \ -(offset = 0x{:x}, size = 0x{:x})", - area.offset, area.size - ); - return Err(VfioPciError::MmapArea); - } - } - for area in sparse_areas.iter() { let mapping = match MmapRegion::mmap( area.size,