File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1212- Added the ` MemoryProtection ` protocol.
1313- Added ` BootServices::get_handle_for_protocol ` .
1414
15+ ### Changed
16+
17+ - Marked ` BootServices::handle_protocol ` as ` unsafe ` . (This method is
18+ also deprecated -- use ` open_protocol ` instead.)
19+
1520### Fixed
1621
1722- The ` BootServices::create_event_ex ` and
Original file line number Diff line number Diff line change @@ -576,14 +576,21 @@ impl BootServices {
576576 /// protections must be implemented by user-level code, for example via a
577577 /// global `HashSet`.
578578 ///
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+ ///
579586 /// [`open_protocol`]: BootServices::open_protocol
580587 #[ 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 > (
582589 & self ,
583590 handle : Handle ,
584591 ) -> Result < & UnsafeCell < P > > {
585592 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 ( || {
587594 let ptr = P :: mut_ptr_from_ffi ( ptr) as * const UnsafeCell < P > ;
588595 & * ptr
589596 } )
You can’t perform that action at this time.
0 commit comments