Skip to content

Commit b40eac1

Browse files
committed
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.
1 parent a143355 commit b40eac1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/addr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl VirtAddr {
7070
match addr.get_bits(47..64) {
7171
0 | 0x1ffff => Ok(VirtAddr(addr)), // address is canonical
7272
1 => Ok(VirtAddr::new_truncate(addr)), // address needs sign extension
73-
other => Err(VirtAddrNotValid(other)),
73+
_ => Err(VirtAddrNotValid(addr)),
7474
}
7575
}
7676

@@ -367,7 +367,7 @@ impl PhysAddr {
367367
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid> {
368368
match addr.get_bits(52..64) {
369369
0 => Ok(PhysAddr(addr)), // address is valid
370-
other => Err(PhysAddrNotValid(other)),
370+
_ => Err(PhysAddrNotValid(addr)),
371371
}
372372
}
373373

0 commit comments

Comments
 (0)