From 7a637fe1f42b7b33c35e608e682feb75b32d678e Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 21 Oct 2024 11:33:58 +0100 Subject: [PATCH] vmm: memory_manager: Use div_ceil() --> vmm/src/memory_manager.rs:1972:13 | 1972 | ... ((self.start_of_device_area.0 + SGX_PAGE_SIZE - 1) / SGX_PAGE_SIZE) * ... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `self.start_of_device_area.0.div_ceil(SGX_PAGE_SIZE)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil = note: `#[warn(clippy::manual_div_ceil)]` on by default Signed-off-by: Rob Bradford --- vmm/src/memory_manager.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vmm/src/memory_manager.rs b/vmm/src/memory_manager.rs index e62bc4236..267bba586 100644 --- a/vmm/src/memory_manager.rs +++ b/vmm/src/memory_manager.rs @@ -1968,9 +1968,8 @@ impl MemoryManager { } // Place the SGX EPC region on a 4k boundary between the RAM and the device area - let epc_region_start = GuestAddress( - ((self.start_of_device_area.0 + SGX_PAGE_SIZE - 1) / SGX_PAGE_SIZE) * SGX_PAGE_SIZE, - ); + let epc_region_start = + GuestAddress(self.start_of_device_area.0.div_ceil(SGX_PAGE_SIZE) * SGX_PAGE_SIZE); self.start_of_device_area = epc_region_start .checked_add(epc_region_size)