From 4b292afafcd44ca3fc34f483a8edb455a3212cb5 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 12 Apr 2019 16:57:48 -0700 Subject: 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 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 Tested-by: David Tolnay Tested-by: kokoro Reviewed-by: David Tolnay --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index dbb203c..048681f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ wl-dmabuf = ["devices/wl-dmabuf", "gpu_buffer", "resources/wl-dmabuf"] [dependencies] arch = { path = "arch" } +assertions = { path = "assertions" } audio_streams = "*" bit_field = { path = "bit_field" } byteorder = "=1.1.0" -- cgit 1.4.1