Skip to content

Commit c596f77

Browse files
antonio-hickeyintel-lab-lkp
authored andcommitted
rust: uaccess: mark UserSliceWriter method inline
When you build the kernel using the llvm-19.1.4-rust-1.83.0-x86_64 toolchain provided by kernel.org with ARCH=x86_64, the following symbol is generated: $nm vmlinux | grep ' _R' | rustfilt | rg UserSliceWriter ffffffff817c3390 T <kernel::uaccess::UserSliceWriter>::write_slice However, this Rust symbol is a trivial wrapper around the function copy_from_user. It doesn't make sense to go through a trivial wrapper for this function, so mark it inline. After applying this patch, the above command will produce no output. Suggested-by: Alice Ryhl <[email protected]> Link: Rust-for-Linux#1145 Signed-off-by: Antonio Hickey <[email protected]>
1 parent ab2ebb7 commit c596f77

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

rust/kernel/uaccess.rs

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ impl UserSliceWriter {
322322
/// Fails with [`EFAULT`] if the write happens on a bad address, or if the write goes out of
323323
/// bounds of this [`UserSliceWriter`]. This call may modify the associated userspace slice even
324324
/// if it returns an error.
325+
#[inline]
325326
pub fn write_slice(&mut self, data: &[u8]) -> Result {
326327
let len = data.len();
327328
let data_ptr = data.as_ptr().cast::<c_void>();

0 commit comments

Comments
 (0)