mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 22:05:20 +00:00
virtio-devices: vhost_user: fs: Don't reference packed struct
error: reference to packed field is unaligned --> virtio-devices/src/vhost_user/fs.rs:85:21 | 85 | fs.flags[i].bits() as i32, | ^^^^^^^^^^^ | = note: `-D unaligned-references` implied by `-D warnings` = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
f0b64547c2
commit
c418074360
@ -78,11 +78,12 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
||||
}
|
||||
|
||||
let addr = self.mmap_cache_addr + offset;
|
||||
let flags = fs.flags[i];
|
||||
let ret = unsafe {
|
||||
libc::mmap(
|
||||
addr as *mut libc::c_void,
|
||||
len as usize,
|
||||
fs.flags[i].bits() as i32,
|
||||
flags.bits() as i32,
|
||||
libc::MAP_SHARED | libc::MAP_FIXED,
|
||||
fd,
|
||||
fs.fd_offset[i] as libc::off_t,
|
||||
|
Loading…
Reference in New Issue
Block a user