diff --git a/kernel/src/libs/align.rs b/kernel/src/libs/align.rs index 4beee8aa2..e3815b324 100644 --- a/kernel/src/libs/align.rs +++ b/kernel/src/libs/align.rs @@ -132,7 +132,7 @@ unsafe impl SafeForZero for [u8; NUM] {} /// 返回值:对齐后的地址。 pub const fn page_align_up(addr: usize) -> usize { let page_size = MMArch::PAGE_SIZE; - return (addr + page_size - 1) & (!(page_size - 1)); + return addr.wrapping_add(page_size - 1) & (!(page_size - 1)); } pub const fn page_align_down(addr: usize) -> usize {