Skip to content

Commit ec0269b

Browse files
uefi: Fix unsafe_op_in_unsafe_fn in gop module
1 parent f7f0dd5 commit ec0269b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

uefi/src/proto/console/gop.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl FrameBuffer<'_> {
589589
#[inline]
590590
pub unsafe fn write_byte(&mut self, index: usize, value: u8) {
591591
debug_assert!(index < self.size, "Frame buffer accessed out of bounds");
592-
self.base.add(index).write_volatile(value)
592+
unsafe { self.base.add(index).write_volatile(value) }
593593
}
594594

595595
/// Read the i-th byte of the frame buffer
@@ -603,7 +603,7 @@ impl FrameBuffer<'_> {
603603
#[must_use]
604604
pub unsafe fn read_byte(&self, index: usize) -> u8 {
605605
debug_assert!(index < self.size, "Frame buffer accessed out of bounds");
606-
self.base.add(index).read_volatile()
606+
unsafe { self.base.add(index).read_volatile() }
607607
}
608608

609609
/// Write a value in the frame buffer, starting at the i-th byte
@@ -624,8 +624,10 @@ impl FrameBuffer<'_> {
624624
index.saturating_add(size_of::<T>()) <= self.size,
625625
"Frame buffer accessed out of bounds"
626626
);
627-
let ptr = self.base.add(index).cast::<T>();
628-
ptr.write_volatile(value)
627+
unsafe {
628+
let ptr = self.base.add(index).cast::<T>();
629+
ptr.write_volatile(value)
630+
}
629631
}
630632

631633
/// Read a value from the frame buffer, starting at the i-th byte
@@ -647,6 +649,6 @@ impl FrameBuffer<'_> {
647649
index.saturating_add(size_of::<T>()) <= self.size,
648650
"Frame buffer accessed out of bounds"
649651
);
650-
(self.base.add(index) as *const T).read_volatile()
652+
unsafe { (self.base.add(index) as *const T).read_volatile() }
651653
}
652654
}

0 commit comments

Comments
 (0)