mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-01 04:28:48 +00:00
55bf685478
This currently gives a compiler warning: warning: dereferencing a null pointer --> aarch64/src/lib.rs:71:19 | 71 | unsafe { &(*(0 as *const $str))$(.$field)* $([$idx])* as *const _ as usize } | ^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed ... 622 | arm64_core_reg!(pc) | ------------------- in this macro invocation | = note: this warning originates in the macro `offset__of` (in Nightly builds, run with -Z macro-backtrace for more info) Fix the UB with an implementation based on memoffset::offset_of and addr_of_mut! instead. BUG=none TEST=`emerge-kukui crosvm` no longer complains about UB Change-Id: I0ab55dc7527c3a4acffe02ee587742dbddd45a0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3270099 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org> |
||
---|---|---|
.. | ||
src | ||
.build_test_skip | ||
Cargo.toml |