mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
io_uring: allow alignment-changing casts of mmap
uring.rs wraps the kernel io_uring interfaces that provide C-style raw pointers, which requires casting a *u8 into other types with stricter alignment requirements. All of these casts are based on the base mmap() pointer (which is always page aligned) or offsets within an mmap provided by the kernel, so we can assume they are safe to cast to the relevant more-aligned types. Fixes clippy warnings of the form: casting from `*mut u8` to a more-strictly-aligned pointer (`*const std::sync::atomic::AtomicU32`) (1 < 4 bytes) BUG=None TEST=bin/clippy Change-Id: Ibef32bb8529d34ece79f089992ad8bd880c5030b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2253068 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
635f90cd83
commit
4c64fa7c6f
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,10 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This file makes several casts from u8 pointers into more-aligned pointer types.
|
||||
// We assume that the kernel will give us suitably aligned memory.
|
||||
#![allow(clippy::cast_ptr_alignment)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
use std::fs::File;
|
||||
|
|
Loading…
Reference in a new issue