Skip to content

Commit f5c2e4f

Browse files
committed
uefi runtime: Fixup increase default size of name buffer
Address PR comments: update code comments, move `use alloc::vec` into appropriate cfg block.
1 parent 7385a2f commit f5c2e4f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

uefi/src/runtime.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//! functions after exiting boot services; see the "Calling Convention" section
88
//! of the UEFI specification for details.
99
10-
use alloc::vec;
1110
use crate::data_types::PhysicalAddress;
1211
use crate::table::{self, Revision};
1312
use crate::{CStr16, Error, Result, Status, StatusExt};
@@ -18,7 +17,7 @@ use uefi_raw::table::boot::MemoryDescriptor;
1817
#[cfg(feature = "alloc")]
1918
use {
2019
crate::mem::make_boxed, crate::CString16, crate::Guid, alloc::borrow::ToOwned,
21-
alloc::boxed::Box, alloc::vec::Vec,
20+
alloc::boxed::Box, alloc::{vec, vec::Vec}
2221
};
2322

2423
#[cfg(all(feature = "unstable", feature = "alloc"))]
@@ -269,12 +268,14 @@ pub struct VariableKeys {
269268
#[cfg(feature = "alloc")]
270269
impl VariableKeys {
271270
fn new() -> Self {
272-
// Create a the name buffer with a reasonable default capacity, and
273-
// initialize it to an empty null-terminated string.
274-
let name = vec![0;512];
271+
// Create a name buffer with a large default size and zero
272+
// initialize it. A Toshiba Satellite Pro R50-B-12P was found
273+
// to not correctly update the VariableNameSize passed into
274+
// GetNextVariableName and starting with a large buffer works
275+
// around this issue.
276+
let name = vec![0; 512];
275277

276278
Self {
277-
// Give the name buffer a reasonable default capacity.
278279
name,
279280
// The initial vendor GUID is arbitrary.
280281
vendor: VariableVendor(Guid::default()),

0 commit comments

Comments
 (0)