* [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
@ 2026-11-25 12:24 Janne Grunau
2026-11-25 22:12 ` Gary Guo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Janne Grunau @ 2026-11-25 12:24 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Danilo Krummrich, Alice Ryhl,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
Tamir Duberstein, Alexandre Courbot, Onur Özkan
Cc: dri-devel, rust-for-linux, linux-kernel, Janne Grunau
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@jannau.net>
---
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@jannau.net>
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
2026-11-25 12:24 [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment Janne Grunau
@ 2026-11-25 22:12 ` Gary Guo
2026-11-26 10:03 ` Alice Ryhl
2026-11-26 22:24 ` Danilo Krummrich
2 siblings, 0 replies; 4+ messages in thread
From: Gary Guo @ 2026-11-25 22:12 UTC (permalink / raw)
To: Janne Grunau, David Airlie, Simona Vetter, Danilo Krummrich,
Alice Ryhl, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan
Cc: dri-devel, rust-for-linux, linux-kernel
On Wed Nov 25, 2026 at 12:24 PM GMT, Janne Grunau wrote:
> 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@jannau.net>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> 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(-)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
2026-11-25 12:24 [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment Janne Grunau
2026-11-25 22:12 ` Gary Guo
@ 2026-11-26 10:03 ` Alice Ryhl
2026-11-26 22:24 ` Danilo Krummrich
2 siblings, 0 replies; 4+ messages in thread
From: Alice Ryhl @ 2026-11-26 10:03 UTC (permalink / raw)
To: Janne Grunau
Cc: Alice Ryhl, David Airlie, Simona Vetter, Danilo Krummrich,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
Tamir Duberstein, Alexandre Courbot, Onur Özkan, dri-devel,
rust-for-linux, linux-kernel
On Wed, Nov 25, 2026 at 01:24:28PM +0100, Janne Grunau wrote:
> 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@jannau.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Alice
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
2026-11-25 12:24 [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment Janne Grunau
2026-11-25 22:12 ` Gary Guo
2026-11-26 10:03 ` Alice Ryhl
@ 2026-11-26 22:24 ` Danilo Krummrich
2 siblings, 0 replies; 4+ messages in thread
From: Danilo Krummrich @ 2026-11-26 22:24 UTC (permalink / raw)
To: Janne Grunau
Cc: David Airlie, Simona Vetter, Danilo Krummrich, Alice Ryhl,
Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Trevor Gross, Daniel Almeida,
Tamir Duberstein, Alexandre Courbot, Onur Özkan, dri-devel,
rust-for-linux, linux-kernel
On Wed, 25 Nov 2026 13:24:28 +0100, Janne Grunau wrote:
> [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
Applied, thanks!
Branch: drm-rust-next
Tree: https://gitlab.freedesktop.org/drm/rust/kernel.git
[1/1] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment
commit: 335792313aa3
The patch will appear in the next linux-next integration (typically within 24
hours on weekdays).
The patch is queued up for the upcoming merge window for the next major kernel
release.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-26 22:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 12:24 [PATCH] rust: drm: gem: shmem: Drop unused unsafe for vm_ops assignment Janne Grunau
2026-11-25 22:12 ` Gary Guo
2026-11-26 10:03 ` Alice Ryhl
2026-11-26 22:24 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox