Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d6e7bb5

Browse files
committed
uefi: Fix io-align == 0 edgecase handling for ata & nvme
1 parent a8b8b61 commit d6e7bb5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

‎uefi/src/proto/ata/pass_thru.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ impl AtaPassThru {
4242
/// The [`AtaPassThruMode`] structure containing configuration details of the protocol.
4343
#[must_use]
4444
pub fn mode(&self) -> AtaPassThruMode {
45-
unsafe { (*self.0.mode).clone() }
45+
let mut mode = unsafe { (*self.0.mode).clone() };
46+
mode.io_align = mode.io_align.max(1); // 0 and 1 is the same, says UEFI spec
47+
mode
4648
}
4749

4850
/// Retrieves the I/O buffer alignment required by this SCSI channel.

‎uefi/src/proto/nvme/pass_thru.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ impl NvmePassThru {
4949
/// An instance of [`NvmePassThruMode`] describing the NVMe controller's capabilities.
5050
#[must_use]
5151
pub fn mode(&self) -> NvmePassThruMode {
52-
unsafe { (*self.0.mode).clone() }
52+
let mut mode = unsafe { (*self.0.mode).clone() };
53+
mode.io_align = mode.io_align.max(1); // 0 and 1 is the same, says UEFI spec
54+
mode
5355
}
5456

5557
/// Retrieves the alignment requirements for I/O buffers.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /