Skip to content

Commit d1e9264

Browse files
committed
Add proper nosemgrep
Signed-off-by: Erick Bourgeois <erick@jeb.ca>
1 parent 18d05d1 commit d1e9264

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/netlink_proc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,9 @@ mod linux_impl {
540540
// - `errno` is read via `Error::last_os_error()` only on
541541
// the error branch and only on the same thread that
542542
// made the syscall, so the value is well-defined.
543-
// nosemgrep: rust.lang.security.unsafe-usage.unsafe-usage
543+
// nosemgrep
544544
let raw_fd = unsafe {
545+
// nosemgrep
545546
nix::libc::socket(
546547
nix::libc::AF_NETLINK,
547548
nix::libc::SOCK_DGRAM | nix::libc::SOCK_CLOEXEC,
@@ -563,8 +564,7 @@ mod linux_impl {
563564
// raw fd is never used again as an integer after this
564565
// line. The `OwnedFd` will `close(2)` it on `Drop`,
565566
// satisfying the close-exactly-once invariant.
566-
// nosemgrep: rust.lang.security.unsafe-usage.unsafe-usage
567-
let fd = unsafe { OwnedFd::from_raw_fd(raw_fd) };
567+
let fd = unsafe { OwnedFd::from_raw_fd(raw_fd) }; // nosemgrep
568568

569569
// pid=0 lets the kernel pick our netlink address;
570570
// groups=CN_IDX_PROC subscribes to the proc-event multicast

0 commit comments

Comments
 (0)