Skip to content

Commit f76989b

Browse files
uefi: Fix unsafe_op_in_unsafe_fn in util module
1 parent 322fa3e commit f76989b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

uefi/src/util.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ use core::ptr::{self, NonNull};
55
/// Copy the bytes of `val` to `ptr`, then advance pointer to just after the
66
/// newly-copied bytes.
77
pub unsafe fn ptr_write_unaligned_and_add<T>(ptr: &mut *mut u8, val: T) {
8-
ptr.cast::<T>().write_unaligned(val);
9-
*ptr = ptr.add(size_of::<T>());
8+
unsafe {
9+
ptr.cast::<T>().write_unaligned(val);
10+
*ptr = ptr.add(size_of::<T>());
11+
}
1012
}
1113

1214
/// Convert from a `u32` to a `usize`. Panic if the input does fit. On typical

0 commit comments

Comments
 (0)