Skip to content

Commit

Permalink
kernel/protocols/vtpm: add missing safety comment
Browse files Browse the repository at this point in the history
Add SAFETY comment around `from_raw_parts_mut()` call.

Signed-off-by: Stefano Garzarella <[email protected]>
  • Loading branch information
stefano-garzarella committed Jan 7, 2025
1 parent 03d4db8 commit d350ae4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/src/protocols/vtpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ fn vtpm_command_request(params: &RequestParams) -> Result<(), SvsmReqError> {
return Err(SvsmReqError::unsupported_call());
}

// SAFETY: vaddr is just mapped, and its size is PAGE_SIZE
let buffer = unsafe { from_raw_parts_mut(vaddr.as_mut_ptr::<u8>(), PAGE_SIZE) };

let response_size = match cmd {
Expand Down

0 comments on commit d350ae4

Please sign in to comment.