Skip to content

Commit 055cc9d

Browse files
authored
Fixes #121: ignore EFI_DEVICE_ERROR in output_string (#122)
* Fixes #121: ignore EFI_DEVICE_ERROR in output_string Signed-off-by: imtsuki <[email protected]> * ignore Result in logger rather than Output protocol Signed-off-by: imtsuki <[email protected]> * Add a FIXME comment that we are ignoring logger's `Result` Signed-off-by: imtsuki <[email protected]>
1 parent 006c388 commit 055cc9d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/logger.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ impl<'boot> log::Log for Logger {
5656
fn log(&self, record: &log::Record) {
5757
if let Some(mut ptr) = self.writer {
5858
let writer = unsafe { ptr.as_mut() };
59-
DecoratedLog::write(writer, record.level(), record.args()).unwrap();
59+
// FIXME: Some UEFI firmware implementations e.g. VrtualBox's implementation
60+
// occasionally report a EFI_DEVICE_ERROR with some text dropped out within
61+
// SimpleTextOutput protocol, which is a firmware bug. In that case, we will
62+
// get a `fmt::Error` here. Since the `log` crate gives no other option to
63+
// deal with output errors, we ignore the `Result` here to prevent potential
64+
// panics from happening.
65+
DecoratedLog::write(writer, record.level(), record.args()).unwrap_or_default();
6066
}
6167
}
6268

0 commit comments

Comments
 (0)