Skip to content

Commit

Permalink
Merge #1922
Browse files Browse the repository at this point in the history
1922: feat: I/O safety for 'kmod' r=asomers a=SteveLauC

#### What this PR does:

1. Adds I/O safety for module `kmod`.

Co-authored-by: Steve Lau <[email protected]>
  • Loading branch information
bors[bot] and SteveLauC authored Dec 8, 2022
2 parents 67f7d46 + 2f546c9 commit 7f18847
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/kmod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! For more details see
use std::ffi::CStr;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::{AsFd, AsRawFd};

use crate::errno::Errno;
use crate::Result;
Expand Down Expand Up @@ -79,15 +79,15 @@ libc_bitflags!(
/// ```
///
/// See [`man init_module(2)`](https://man7.org/linux/man-pages/man2/init_module.2.html) for more information.
pub fn finit_module<T: AsRawFd>(
fd: &T,
pub fn finit_module<Fd: AsFd>(
fd: &Fd,
param_values: &CStr,
flags: ModuleInitFlags,
) -> Result<()> {
let res = unsafe {
libc::syscall(
libc::SYS_finit_module,
fd.as_raw_fd(),
fd.as_fd().as_raw_fd(),
param_values.as_ptr(),
flags.bits(),
)
Expand Down

0 comments on commit 7f18847

Please sign in to comment.