[PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
From: Janne Grunau
Date: Wed Nov 25 2026 - 07:24:40 EST
The assignment uses a raw const pointer referencing the static const
drm_gem_shmem_vm_ops from C side. This is safe since Rust 1.82.0 as
stated by the #[allow(unused_unsafe)]` attribute.
This was added in parallel with commit f32fb9c58a5b ("rust: bump Rust
minimum supported version to 1.85.0 (Debian Trixie)") for Linux v7.1.
Drop the unsafe, the SAFETY comment and the attribute as they are always
unused with Rust 1.85.0 and later.
Signed-off-by: Janne Grunau <j@xxxxxxxxxx>
---
randomly spotted while looking at the source, no other
`#[allow(unused_unsafe)]` in rust/kernel can be dropped for the same
reason.
Tested with rust 1.85.1 and 1.100.0
---
rust/kernel/drm/gem/shmem.rs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
index 24cb5343e0db..fb8c70d0e4c8 100644
--- a/rust/kernel/drm/gem/shmem.rs
+++ b/rust/kernel/drm/gem/shmem.rs
@@ -138,9 +138,7 @@ impl<T: DriverObject> Object<T> {
vmap: Some(bindings::drm_gem_shmem_object_vmap),
vunmap: Some(bindings::drm_gem_shmem_object_vunmap),
mmap: Some(bindings::drm_gem_shmem_object_mmap),
- #[allow(unused_unsafe, reason = "Safe since Rust 1.82.0")]
- // SAFETY: `drm_gem_shmem_vm_ops` is a valid, static const on the C side.
- vm_ops: unsafe { &raw const bindings::drm_gem_shmem_vm_ops },
+ vm_ops: &raw const bindings::drm_gem_shmem_vm_ops,
..pin_init::zeroed()
};
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261125-rust-drm-gem-shmem-unused-unsafe-559fa1565661
Best regards,
--
Janne Grunau <j@xxxxxxxxxx>