@@ -45,7 +45,7 @@ trait InfoInternal: Align + ptr_meta::Pointee<Metadata = usize> {
45
45
/// struct.
46
46
unsafe fn name_ptr ( ptr : * mut u8 ) -> * mut Char16 {
47
47
let offset_of_str = Self :: name_offset ( ) ;
48
- ptr. add ( offset_of_str) . cast :: < Char16 > ( )
48
+ unsafe { ptr. add ( offset_of_str) . cast :: < Char16 > ( ) }
49
49
}
50
50
51
51
/// Create a new info type in user-provided storage.
@@ -95,13 +95,13 @@ trait InfoInternal: Align + ptr_meta::Pointee<Metadata = usize> {
95
95
// Create a pointer to the part of info where the name is
96
96
// stored. Note that `info_ptr` is used rather than `storage` to
97
97
// comply with Stacked Borrows.
98
- let info_name_ptr = Self :: name_ptr ( info_ptr. cast :: < u8 > ( ) ) ;
98
+ let info_name_ptr = unsafe { Self :: name_ptr ( info_ptr. cast :: < u8 > ( ) ) } ;
99
99
100
100
// Initialize the name slice.
101
- ptr:: copy ( name. as_ptr ( ) , info_name_ptr, name_length_ucs2) ;
101
+ unsafe { ptr:: copy ( name. as_ptr ( ) , info_name_ptr, name_length_ucs2) } ;
102
102
103
103
// The struct is now valid and safe to dereference.
104
- let info = & mut * info_ptr;
104
+ let info = unsafe { & mut * info_ptr } ;
105
105
Ok ( info)
106
106
}
107
107
}
@@ -111,10 +111,10 @@ where
111
111
T : InfoInternal + ?Sized ,
112
112
{
113
113
unsafe fn from_uefi < ' ptr > ( ptr : * mut c_void ) -> & ' ptr mut Self {
114
- let name_ptr = Self :: name_ptr ( ptr. cast :: < u8 > ( ) ) ;
115
- let name = CStr16 :: from_ptr ( name_ptr) ;
114
+ let name_ptr = unsafe { Self :: name_ptr ( ptr. cast :: < u8 > ( ) ) } ;
115
+ let name = unsafe { CStr16 :: from_ptr ( name_ptr) } ;
116
116
let name_len = name. as_slice_with_nul ( ) . len ( ) ;
117
- & mut * ptr_meta:: from_raw_parts_mut ( ptr. cast :: < ( ) > ( ) , name_len)
117
+ unsafe { & mut * ptr_meta:: from_raw_parts_mut ( ptr. cast :: < ( ) > ( ) , name_len) }
118
118
}
119
119
}
120
120
0 commit comments