crosvm/x86_64
David Tolnay 4b292afafc clippy: Resolve cast_ptr_alignment
This CL fixes four cases of what I believe are undefined behavior:

  - In vhost where the original code allocates a Vec<u8> with 1-byte
    alignment and casts the Vec's data pointer to a &mut vhost_memory
    which is required to be 8-byte aligned. Underaligned references of
    type &T or &mut T are always undefined behavior in Rust.

  - Same pattern in x86_64.

  - Same pattern in plugin::vcpu.

  - Code in crosvm_plugin that dereferences a potentially underaligned
    pointer. This is always undefined behavior in Rust.

TEST=bin/clippy
TEST=cargo test sys_util

Change-Id: I926f17b1fe022a798f69d738f9990d548f40c59b
Reviewed-on: https://chromium-review.googlesource.com/1566736
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Tolnay <dtolnay@chromium.org>
2019-04-18 19:51:29 -07:00
..
src clippy: Resolve cast_ptr_alignment 2019-04-18 19:51:29 -07:00
build.rs edition: Remove extern crate lines 2019-04-15 02:06:08 -07:00
Cargo.toml clippy: Resolve cast_ptr_alignment 2019-04-18 19:51:29 -07:00
host_cpuid.c x86_64: fill cache info in cpuid, stop spoofing CPU vendor id 2018-07-09 12:42:42 -07:00