mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
The pointer created by `Vec::as_ptr` may not be used for mutation of the underlying data [0]. This PR switches to `Vec::as_mut_ptr` and uses `cast` to avoid mutability changes when casting. Also improves safety reasoning, separates the unsafe call from the call to `read_exact` to improve clarity and simplifies the vector creation. [0]: https://doc.rust-lang.org/alloc/vec/struct.Vec.html#method.as_ptr On-behalf-of: SAP julian.schindel@sap.com Signed-off-by: Julian Schindel <julian.schindel@cyberus-technology.de>