mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Miguel Ojeda <ojeda@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, Boqun Feng <boqun@kernel.org>,
	Gary Guo <gary@garyguo.net>,
	Alexandre Courbot <acourbot@nvidia.com>,
	rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH v12 1/1] rust: interop: Add list module for C linked list interface
Date: Mon, 16 Mar 2026 14:54:12 -0400	[thread overview]
Message-ID: <9a70c268-23d7-4cf3-a88a-d6a7aa1489fc@nvidia.com> (raw)
In-Reply-To: <CANiq72kEnDyUpnWMZmheJytjioeiJUK_C-yQJk77dPid89LExw@mail.gmail.com>

On Thu, 12 Mar 2026 20:20:10 +0100, Miguel Ojeda wrote:
> Was the patch tested with Clippy? It has several issues.
>
> The worst news is that it seems the "supposed to be `unsafe` block"
> does not count as one for Clippy, i.e.:
>
>     let list = clist_create!(unsafe { head, Item, SampleItemC, link });
>
> So we get:
>
>     error: statement has unnecessary safety comment
>
> For this, we could write them as a `// SAFETY*: ` comment or similar,
> to make progress for now, but it would best to request upstream Clippy
> to detect this or to rework the macro to force the `unsafe` block
> outside.

Used `// SAFETY*:` for now as you suggested.

>     error: unsafe block missing a safety comment
>        --> rust/kernel/interop/list.rs:357:17
>         |
>     357 |             |p| unsafe { &raw const (*p).$($field).+ };
>
> So this needs a `// SAFETY:` comment on top of the closure.

Fixed. Added:

    // SAFETY: `p` is a valid pointer to `$c_type`.

>     error: this macro expands metavariables in an unsafe block
>        --> rust/kernel/interop/list.rs:362:9
>         |
>     362 |         unsafe { $crate::interop::list::CList::<$rust_type,
>     OFFSET>::from_raw($head) }
>
> For this one, to begin with, do we expect to have actual expressions
> for $head, or could we constrain it for now to an identifier for
> instance?
>
> With an identifier there is no issue then -- the example currently has
> just an identifier anyway.

Yes, identifier should be Ok. Changed to it.

thanks,

--
Joel Fernandes

  parent reply	other threads:[~2026-03-16 18:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 20:36 [PATCH v12 0/1] " Joel Fernandes
2026-03-06 20:36 ` [PATCH v12 1/1] " Joel Fernandes
2026-03-12 17:42   ` Danilo Krummrich
2026-03-12 19:15     ` Miguel Ojeda
2026-03-12 19:16   ` Miguel Ojeda
2026-03-16 18:47     ` Joel Fernandes
2026-03-12 19:20   ` Miguel Ojeda
2026-03-12 19:50     ` Danilo Krummrich
2026-03-16 17:57       ` Joel Fernandes
2026-03-16 18:54     ` Joel Fernandes [this message]
2026-03-16  4:34   ` Alexandre Courbot

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=9a70c268-23d7-4cf3-a88a-d6a7aa1489fc@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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®