From bf1e886ff5115a960672dfa21abb8f5888359238 Mon Sep 17 00:00:00 2001 From: Peter Fang Date: Sat, 9 Nov 2024 00:54:02 -0800 Subject: [PATCH] platform/tdp: Error on !VTOM VTOM shall never be 0 on TDP platforms. Return an error if this is the case. Signed-off-by: Peter Fang --- kernel/src/platform/tdp.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/src/platform/tdp.rs b/kernel/src/platform/tdp.rs index 9889f6249..b95f41966 100644 --- a/kernel/src/platform/tdp.rs +++ b/kernel/src/platform/tdp.rs @@ -44,6 +44,9 @@ impl SvsmPlatform for TdpPlatform { } fn env_setup(&mut self, debug_serial_port: u16, vtom: usize) -> Result<(), SvsmError> { + if vtom == 0 { + return Err(SvsmError::PlatformInit); + } VTOM.init(&vtom).map_err(|_| SvsmError::PlatformInit)?; // Serial console device can be initialized immediately init_svsm_console(&GHCI_IO_DRIVER, debug_serial_port)