From b40eac1cd6228aa151668737923acf27074b4876 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 1 Mar 2022 11:41:32 +0100 Subject: [PATCH] Fix: `VirtAddrNotValid` and `PhysAddrNotValid` should contain the whole address Not just the invalid higher bits. We made the internal fields public in #340, but fortunately we didn't release this change yet, so this fix is still non-breaking. --- src/addr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addr.rs b/src/addr.rs index 74f677453..0c49c9d67 100644 --- a/src/addr.rs +++ b/src/addr.rs @@ -70,7 +70,7 @@ impl VirtAddr { match addr.get_bits(47..64) { 0 | 0x1ffff => Ok(VirtAddr(addr)), // address is canonical 1 => Ok(VirtAddr::new_truncate(addr)), // address needs sign extension - other => Err(VirtAddrNotValid(other)), + _ => Err(VirtAddrNotValid(addr)), } } @@ -367,7 +367,7 @@ impl PhysAddr { pub fn try_new(addr: u64) -> Result { match addr.get_bits(52..64) { 0 => Ok(PhysAddr(addr)), // address is valid - other => Err(PhysAddrNotValid(other)), + _ => Err(PhysAddrNotValid(addr)), } }