File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,11 @@ unsafe impl GlobalAlloc for Allocator {
90
90
// write is appropriately aligned for a `*mut u8` pointer because
91
91
// `align_ptr` is aligned, and alignments are always powers of two
92
92
// (as enforced by the `Layout` type).
93
- let aligned_ptr = full_alloc_ptr. add ( offset) ;
94
- ( aligned_ptr. cast :: < * mut u8 > ( ) ) . sub ( 1 ) . write ( full_alloc_ptr) ;
95
- aligned_ptr
93
+ unsafe {
94
+ let aligned_ptr = full_alloc_ptr. add ( offset) ;
95
+ ( aligned_ptr. cast :: < * mut u8 > ( ) ) . sub ( 1 ) . write ( full_alloc_ptr) ;
96
+ aligned_ptr
97
+ }
96
98
} else {
97
99
// The requested alignment is less than or equal to eight, and
98
100
// `allocate_pool` always provides eight-byte alignment, so we can
@@ -108,13 +110,13 @@ unsafe impl GlobalAlloc for Allocator {
108
110
if layout. align ( ) > 8 {
109
111
// Retrieve the pointer to the full allocation that was packed right
110
112
// before the aligned allocation in `alloc`.
111
- ptr = ( ptr as * const * mut u8 ) . sub ( 1 ) . read ( ) ;
113
+ ptr = unsafe { ( ptr as * const * mut u8 ) . sub ( 1 ) . read ( ) } ;
112
114
}
113
115
114
116
// OK to unwrap: `ptr` is required to be a valid allocation by the trait API.
115
117
let ptr = NonNull :: new ( ptr) . unwrap ( ) ;
116
118
117
119
// Warning: this will panic after exiting boot services.
118
- boot:: free_pool ( ptr) . unwrap ( ) ;
120
+ unsafe { boot:: free_pool ( ptr) } . unwrap ( ) ;
119
121
}
120
122
}
You can’t perform that action at this time.
0 commit comments