File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 12
12
- Added the ` MemoryProtection ` protocol.
13
13
- Added ` BootServices::get_handle_for_protocol ` .
14
14
15
+ ### Changed
16
+
17
+ - Marked ` BootServices::handle_protocol ` as ` unsafe ` . (This method is
18
+ also deprecated -- use ` open_protocol ` instead.)
19
+
15
20
### Fixed
16
21
17
22
- The ` BootServices::create_event_ex ` and
Original file line number Diff line number Diff line change @@ -576,14 +576,21 @@ impl BootServices {
576
576
/// protections must be implemented by user-level code, for example via a
577
577
/// global `HashSet`.
578
578
///
579
+ /// # Safety
580
+ ///
581
+ /// This method is unsafe because the handle database is not
582
+ /// notified that the handle and protocol are in use; there is no
583
+ /// guarantee that they will remain valid for the duration of their
584
+ /// use. Use [`open_protocol`] instead.
585
+ ///
579
586
/// [`open_protocol`]: BootServices::open_protocol
580
587
#[ deprecated( note = "it is recommended to use `open_protocol` instead" ) ]
581
- pub fn handle_protocol < P : ProtocolPointer + ?Sized > (
588
+ pub unsafe fn handle_protocol < P : ProtocolPointer + ?Sized > (
582
589
& self ,
583
590
handle : Handle ,
584
591
) -> Result < & UnsafeCell < P > > {
585
592
let mut ptr = ptr:: null_mut ( ) ;
586
- ( self . handle_protocol ) ( handle, & P :: GUID , & mut ptr) . into_with_val ( || unsafe {
593
+ ( self . handle_protocol ) ( handle, & P :: GUID , & mut ptr) . into_with_val ( || {
587
594
let ptr = P :: mut_ptr_from_ffi ( ptr) as * const UnsafeCell < P > ;
588
595
& * ptr
589
596
} )
You can’t perform that action at this time.
0 commit comments