Skip to content

Fix various CI failures #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
runs-on: windows-latest
steps:
- name: Install QEMU
run: choco install qemu
run: choco install qemu --version 2023.4.24

- name: Checkout sources
uses: actions/checkout@v3
Expand Down
9 changes: 7 additions & 2 deletions uefi-test-runner/src/proto/media.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloc::string::ToString;
use core::cell::RefCell;
use core::ptr::NonNull;
use uefi::data_types::Align;
use uefi::prelude::*;
use uefi::proto::media::block::BlockIO;
use uefi::proto::media::disk::{DiskIo, DiskIo2, DiskIo2Token};
Expand Down Expand Up @@ -29,8 +30,12 @@ fn test_existing_dir(directory: &mut Directory) {

let dir = RefCell::new(dir);

assert_eq!(FileInfo::alignment(), 8);
#[repr(align(8))]
struct Buf([u8; 200]);

// Backing memory to read the file info data into.
let mut stack_buf = [0; 200];
let mut stack_buf = Buf([0; 200]);

// The file names that the test read from the directory.
let entry_names = RefCell::new(vec![]);
Expand All @@ -44,7 +49,7 @@ fn test_existing_dir(directory: &mut Directory) {
let mut entry_names = entry_names.borrow_mut();
loop {
let entry = dir
.read_entry(&mut stack_buf)
.read_entry(&mut stack_buf.0)
.expect("failed to read directory");
if let Some(entry) = entry {
entry_names.push(entry.file_name().to_string());
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/proto/media/file/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ trait InfoInternal: Align + ptr_meta::Pointee<Metadata = usize> {
{
// Calculate the final size of the struct.
let name_length_ucs2 = name.as_slice_with_nul().len();
let name_size = name_length_ucs2 * mem::size_of::<Char16>();
let name_size = mem::size_of_val(name.as_slice_with_nul());
let info_size = Self::name_offset() + name_size;
let info_size = Self::round_up_to_alignment(info_size);

Expand Down
2 changes: 1 addition & 1 deletion uefi/src/proto/network/pxe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ impl DiscoverInfo {
let required_size = core::mem::size_of::<bool>() * 4
+ core::mem::size_of::<IpAddress>()
+ core::mem::size_of::<u16>()
+ core::mem::size_of::<Server>() * server_count;
+ core::mem::size_of_val(srv_list);

if buffer.len() < required_size {
return Err(Status::BUFFER_TOO_SMALL.into());
Expand Down
2 changes: 1 addition & 1 deletion uefi/src/proto/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl Rng {
&mut self,
algorithm_list: &'buf mut [RngAlgorithmType],
) -> Result<&'buf [RngAlgorithmType], Option<usize>> {
let mut algorithm_list_size = algorithm_list.len() * mem::size_of::<RngAlgorithmType>();
let mut algorithm_list_size = mem::size_of_val(algorithm_list);

unsafe {
(self.0.get_info)(
Expand Down
3 changes: 2 additions & 1 deletion uefi/src/result/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
///! Facilities for dealing with UEFI operation results.
//! Facilities for dealing with UEFI operation results.

use core::fmt::Debug;

/// The error type that we use, essentially a status code + optional additional data
Expand Down