mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
13505b2b9e
Rather than using MaybeUninit to create a zeroed instance of a type and std::slice::from_raw_parts_mut() to get a mutable &[u8] referring to it, we can use the zerocopy 0.7 FromZeroes trait new_zeroed() function and the AsBytes + FromBytes as_bytes_mut() function to read from the reader into the type as a mutable &[u8]. This removes all of the unsafe code in the zerocopy_from_reader() function. BUG=None TEST=tools/dev_container tools/presubmit Change-Id: I76b12b69b02e807a3e52ac9b9e7e7165ee1f55f4 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4939612 Reviewed-by: Zihan Chen <zihanchen@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE |