Re: [PATCH] rust: drm: ioctl: fix call to unsafe function
From: Vishal Moola (Fractile)
Date: Wed Nov 18 2026 - 11:58:23 EST
On Wed, Nov 18, 2026 at 05:17:41PM +0100, Danilo Krummrich wrote:
> On Wed Nov 18, 2026 at 2:32 PM CET, Vishal Moola (Fractile) wrote:
> > diff --git a/rust/kernel/drm/ioctl.rs b/rust/kernel/drm/ioctl.rs
> > index 64af9eacc306..5a2e2f4f0e91 100644
> > --- a/rust/kernel/drm/ioctl.rs
> > +++ b/rust/kernel/drm/ioctl.rs
> > @@ -152,7 +152,7 @@ macro_rules! declare_drm_ioctls {
> > // dev/file match the current driver these ioctls are being declared
> > // for, and it's not clear how to enforce this within the type system.
> > let dev: &$crate::drm::device::Device<_, $crate::drm::Ioctl> =
> > - $crate::drm::device::Device::from_raw(raw_dev);
> > + unsafe { $crate::drm::device::Device::from_raw(raw_dev) };
>
> I remember there has been at least one compiler version in the supported range
> that complained when the safety comment isn't directly above the unsafe block.
> Has this been fixed in the meantime?
I'm not sure? I'm compiling with rustc 1.98.1 (48a229cea 2026-09-01) (Fedora 1.98.1-1.fc44)
which gives me no errors like this.
Hopefully the build-bots catch it if there's a specific compiler version
that still dislikes it.
The following command shows a few other occurences in the kernel like this,
so if its still an issue I imagine it'd likely be caught somewhere:
grep -rn -B1 '^\s*unsafe {' rust/kernel | grep '=$'