pvmfw: Validate config header entries when Config::new()
This makes implicit assumptions explicit in one place and also helps to
remove unnecessary checks when getting entries.
Bug: N/A
Test: atest CustomPvmfwHostTestCases
Change-Id: Idad0ce1e827ae94bbdf6afba946a0375e199634f
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index 3efa61e..9c929a9 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -207,10 +207,7 @@
RebootReason::InvalidConfig
})?;
- let (bcc_slice, debug_policy) = appended.get_entries().map_err(|e| {
- error!("Failed to obtained the config entries: {e}");
- RebootReason::InvalidConfig
- })?;
+ let (bcc_slice, debug_policy) = appended.get_entries();
// Up to this point, we were using the built-in static (from .rodata) page tables.
MEMORY.lock().replace(MemoryTracker::new(
@@ -430,10 +427,10 @@
}
}
- fn get_entries(&mut self) -> config::Result<(&mut [u8], Option<&mut [u8]>)> {
+ fn get_entries(&mut self) -> (&mut [u8], Option<&mut [u8]>) {
match self {
Self::Config(ref mut cfg) => cfg.get_entries(),
- Self::LegacyBcc(ref mut bcc) => Ok((bcc, None)),
+ Self::LegacyBcc(ref mut bcc) => (bcc, None),
}
}
}