mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Vishal Moola (Fractile)" <vishal.moola@gmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Asahi Lina" <lina+kernel@asahilina.net>,
	"Lyude Paul" <lyude@redhat.com>,
	dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: drm: ioctl: fix call to unsafe function
Date: Wed, 18 Nov 2026 17:45:57 +0000	[thread overview]
Message-ID: <DMYIVY6SNRZ1.2SWH1M60IQ3QT@garyguo.net> (raw)
In-Reply-To: <av3Y8mTaRi7l-5iy@C422HJQPQG-Fractile>

On Wed Nov 18, 2026 at 4:57 PM GMT, Vishal Moola (Fractile) wrote:
> 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 '=$'

In this particular case, Clippy 1.85 doesn't complain even if SAFETY comment is
removed, so we are all good.

Old version of clippy (the minimum version we require is 1.85) have both false
positive and false negatives and sometimes things just cancel out :)

Best,
Gary

      reply	other threads:[~2026-11-18 17:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 13:32 Vishal Moola (Fractile)
2026-11-18 15:29 ` Alice Ryhl
2026-11-18 15:55   ` Vishal Moola (Fractile)
2026-11-18 16:17 ` Danilo Krummrich
2026-11-18 16:57   ` Vishal Moola (Fractile)
2026-11-18 17:45     ` Gary Guo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DMYIVY6SNRZ1.2SWH1M60IQ3QT@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lina+kernel@asahilina.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vishal.moola@gmail.com \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®