Skip to content

Commit 21cdb54

Browse files
Copilotjsturtevant
andcommitted
Improve unsafe block scope in Windows kill() implementation
Narrowed the unsafe block to only wrap the unsafe function call, keeping the match expression outside for better code clarity. Co-authored-by: jsturtevant <[email protected]>
1 parent 0daa0fd commit 21cdb54

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • src/hyperlight_host/src/hypervisor

src/hyperlight_host/src/hypervisor/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,13 +551,12 @@ impl InterruptHandle for WindowsInterruptHandle {
551551
return false;
552552
}
553553

554-
unsafe {
555-
match WHvCancelRunVirtualProcessor(guard.handle, 0, 0) {
556-
Ok(_) => true,
557-
Err(e) => {
558-
log::error!("Failed to cancel running virtual processor: {}", e);
559-
false
560-
}
554+
let result = unsafe { WHvCancelRunVirtualProcessor(guard.handle, 0, 0) };
555+
match result {
556+
Ok(_) => true,
557+
Err(e) => {
558+
log::error!("Failed to cancel running virtual processor: {}", e);
559+
false
561560
}
562561
}
563562
}

0 commit comments

Comments
 (0)