From 33ef3a326260a0e6fc2bbb69e7c4a7ce46905a0c Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 11 Feb 2022 10:42:05 -0700 Subject: [PATCH] xhcid: panic if BAR is 0 --- xhcid/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xhcid/src/main.rs b/xhcid/src/main.rs index 50304e4c18..f64af404af 100644 --- a/xhcid/src/main.rs +++ b/xhcid/src/main.rs @@ -101,7 +101,10 @@ fn main() { name.push_str("_xhci"); let bar_ptr = match bar { - pcid_interface::PciBar::Memory(ptr) => ptr, + pcid_interface::PciBar::Memory(ptr) => match ptr { + 0 => panic!("BAR is mapped to address 0"), + _ => ptr, + }, other => panic!("Expected memory bar, found {}", other), };