diff options
author | David Tolnay <dtolnay@chromium.org> | 2019-04-12 16:57:48 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-18 19:51:29 -0700 |
commit | 4b292afafcd44ca3fc34f483a8edb455a3212cb5 (patch) | |
tree | 868bdb3122e088e33836cd48608d23518ee5a1d0 /Cargo.lock | |
parent | dc4effa72b214bc3bd14ca2f7772ab1b728aef5b (diff) | |
download | crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar.gz crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar.bz2 crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar.lz crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar.xz crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.tar.zst crosvm-4b292afafcd44ca3fc34f483a8edb455a3212cb5.zip |
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>
Diffstat (limited to 'Cargo.lock')
-rw-r--r-- | Cargo.lock | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock index fa8218b..db79114 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,6 +83,7 @@ version = "0.1.0" dependencies = [ "aarch64 0.1.0", "arch 0.1.0", + "assertions 0.1.0", "audio_streams 0.1.0", "bit_field 0.1.0", "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -521,6 +522,7 @@ dependencies = [ name = "vhost" version = "0.1.0" dependencies = [ + "assertions 0.1.0", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "net_util 0.1.0", "sys_util 0.1.0", @@ -561,6 +563,7 @@ name = "x86_64" version = "0.1.0" dependencies = [ "arch 0.1.0", + "assertions 0.1.0", "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "data_model 0.1.0", |