mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: replace as <pointer> casts with safer alternatives
`as` casts can change mutability, which quickly leads to undefined behavior. Signed-off-by: Julian Schindel <mail@arctic-alpaca.de>
This commit is contained in:
committed by
Rob Bradford
parent
8b101fb890
commit
ae7113e1d4
@@ -185,7 +185,7 @@ impl BalloonEpollHandler {
|
||||
let res =
|
||||
// SAFETY: FFI call with valid arguments, guaranteed by VolatileSlice
|
||||
unsafe {
|
||||
libc::madvise(slice.ptr_guard_mut().as_ptr() as *mut libc::c_void,
|
||||
libc::madvise(slice.ptr_guard_mut().as_ptr().cast(),
|
||||
range_len as libc::size_t, advice) };
|
||||
if res != 0 {
|
||||
return Err(Error::MadviseFail(io::Error::last_os_error()));
|
||||
|
||||
Reference in New Issue
Block a user