fix(aya-sock-map): invalid transmute when calling fd

Corrent an invalid transmutation for sock_map.
fd is already a ref of MapFd, so transmuting &fd to &SockMapFd is
equivalent to transmuting &&SockMapFd into &SockMapFd which is buggy.
pull/880/head
Σrebe - Romain GERARD 1 year ago
parent 46b48053df
commit 061ee08da3
No known key found for this signature in database
GPG Key ID: 7A42B4B97E0332F4

@ -77,7 +77,7 @@ impl<T: Borrow<MapData>> SockMap<T> {
let fd: &MapFd = self.inner.borrow().fd();
// TODO(https://github.com/rust-lang/rfcs/issues/3066): avoid this unsafe.
// SAFETY: `SockMapFd` is #[repr(transparent)] over `MapFd`.
unsafe { std::mem::transmute(&fd) }
unsafe { std::mem::transmute(fd) }
}
}

Loading…
Cancel
Save