Re: [PATCH v11 2/2] rust: clist: Add support to interface with C linked lists

From: Alexandre Courbot

Date: Wed Feb 25 2026 - 03:27:03 EST


On Wed Feb 25, 2026 at 5:09 PM JST, Alexandre Courbot wrote:
> On Wed Feb 25, 2026 at 7:27 AM JST, Joel Fernandes wrote:
>> Add a new module `clist` for working with C's doubly circular linked
>> lists. Provide low-level iteration over list nodes.
>>
>> Typed iteration over actual items is provided with a `clist_create`
>> macro to assist in creation of the `CList` type.
>>
>> Cc: Nikola Djukic <ndjukic@xxxxxxxxxx>
>> Reviewed-by: Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>
>> Acked-by: Gary Guo <gary@xxxxxxxxxxx>
>> Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
>
> Reviewed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
>
> (with one small comment below)

Actually, one more. When trying to build the GPU buddy series on top of
this, I got this warning:

warning: this macro expands metavariables in an unsafe block
--> ../rust/kernel/ffi/clist.rs:336:9
|
336 | unsafe { $crate::ffi::clist::CList::<$rust_type, OFFSET>::from_raw($head) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this allows the user of the macro to write unsafe code outside of an unsafe block
= help: consider expanding any metavariables outside of this block, e.g. by storing them in a variable
= help: ... or also expand referenced metavariables in a safe context to require an unsafe block at callsite
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#macro_metavars_in_unsafe
= note: `-W clippy::macro-metavars-in-unsafe` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::macro_metavars_in_unsafe)]`

The fix should be easy and as prescribed.

Btw, your `nova/mm` branch has not been built with `CLIPPY=1` before
submission - there are still a few of few.