Browse Source

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.
Σrebe - Romain GERARD 1 year ago
parent
commit
c31cce4a36
1 changed files with 1 additions and 1 deletions
  1. 1 1
      aya/src/maps/sock/sock_map.rs

+ 1 - 1
aya/src/maps/sock/sock_map.rs

@@ -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) }
     }
 }