Skip to content

uefi: Fix return value lifetime for register_protocol_notify #1228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions uefi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Changed
- **Breaking:** `uefi::helpers::init` no longer takes an argument.
- The lifetime of the `SearchType` returned from
`BootServices::register_protocol_notify` is now tied to the protocol GUID.


# uefi - 0.29.0 (2024-07-02)
Expand Down
6 changes: 3 additions & 3 deletions uefi/src/table/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@ impl BootServices {
///
/// * [`uefi::Status::OUT_OF_RESOURCES`]
/// * [`uefi::Status::INVALID_PARAMETER`]
pub fn register_protocol_notify(
pub fn register_protocol_notify<'guid>(
&self,
protocol: &Guid,
protocol: &'guid Guid,
event: Event,
) -> Result<(Event, SearchType)> {
) -> Result<(Event, SearchType<'guid>)> {
let mut key = ptr::null();
// Safety: we clone `event` a couple times, but there will be only one left once we return.
unsafe { (self.0.register_protocol_notify)(protocol, event.as_ptr(), &mut key) }
Expand Down