summaryrefslogtreecommitdiff
path: root/rust/kernel/uaccess.rs
diff options
context:
space:
mode:
authorGary Guo <gary@garyguo.net>2024-09-13 22:29:23 +0100
committerMiguel Ojeda <ojeda@kernel.org>2024-11-10 23:58:00 +0100
commitd072acda4862f095ec9056979b654cc06a22cc68 (patch)
tree270061d20e18a9c5ff90cef8e4deed75bdb93c63 /rust/kernel/uaccess.rs
parent2fd6f55c048d0c863ffbc8590b1bd2edb5ff13e5 (diff)
rust: use custom FFI integer types
Currently FFI integer types are defined in libcore. This commit creates the `ffi` crate and asks bindgen to use that crate for FFI integer types instead of `core::ffi`. This commit is preparatory and no type changes are made in this commit yet. Signed-off-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/r/20240913213041.395655-4-gary@garyguo.net [ Added `rustdoc`, `rusttest` and KUnit tests support. Rebased on top of `rust-next` (e.g. migrated more `core::ffi` cases). Reworded crate docs slightly and formatted. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/uaccess.rs')
-rw-r--r--rust/kernel/uaccess.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/kernel/uaccess.rs b/rust/kernel/uaccess.rs
index 2c953ba53c77..05b0b8d13b10 100644
--- a/rust/kernel/uaccess.rs
+++ b/rust/kernel/uaccess.rs
@@ -8,10 +8,10 @@ use crate::{
alloc::Flags,
bindings,
error::Result,
+ ffi::{c_ulong, c_void},
prelude::*,
transmute::{AsBytes, FromBytes},
};
-use core::ffi::{c_ulong, c_void};
use core::mem::{size_of, MaybeUninit};
/// The type used for userspace addresses.
@@ -45,7 +45,7 @@ pub type UserPtr = usize;
/// every byte in the region.
///
/// ```no_run
-/// use core::ffi::c_void;
+/// use kernel::ffi::c_void;
/// use kernel::error::Result;
/// use kernel::uaccess::{UserPtr, UserSlice};
///
@@ -67,7 +67,7 @@ pub type UserPtr = usize;
/// Example illustrating a TOCTOU (time-of-check to time-of-use) bug.
///
/// ```no_run
-/// use core::ffi::c_void;
+/// use kernel::ffi::c_void;
/// use kernel::error::{code::EINVAL, Result};
/// use kernel::uaccess::{UserPtr, UserSlice};
///