Re: [PATCH] rust: list: document safety discharge and add offset_of! check

From: Alexandre Courbot

Date: Mon Sep 21 2026 - 00:54:09 EST


On Mon Sep 21, 2026 at 1:14 PM JST, Yilin Chen wrote:
> Replace the remaining "// Safety: TODO" in the Rust intrusive list
> implementation with explanations.
>
> Also, the `impl_has_list_links_self_ptr!` macro does not perform
> the field-path validation already used by `impl_has_list_links!`.
> As a result, `addr_of_mut!` also accepts paths that require
> implicit dereferencing.

This paragraph sounds like it is an independent fix? Let's put it in its
own patch please as per the guidelines [1].

[1] https://docs.kernel.org/process/submitting-patches.html#separate-your-changes

>
> Use offset_of! in an unreachable branch to ensure that the path consists
> only of actual nested fields. The value is not evaluated, so the check
> has no runtime cost.

This one also? So if my understanding is correct this should be a 3
small (and easy to review) patches series. Your reviewers will be
thankful for the split.