Re: [PATCH v2] rust: list: Add unsafe for container_of
From: Miguel Ojeda
Date: Mon Feb 09 2026 - 05:50:19 EST
On Mon, Feb 9, 2026 at 10:34 AM Philipp Stanner <phasta@xxxxxxxxxx> wrote:
>
> [PATCH v2] rust: list: Add unsafe for container_of
Isn't this v3?
> - let container = $crate::container_of!(
> + let container = unsafe { $crate::container_of!(
> links_field, $crate::list::ListLinksSelfPtr<Self, $num>, inner
> - );
> + ) };
This one and another one below need a `// SAFETY:` comment -- I
mentioned it in v2:
https://lore.kernel.org/rust-for-linux/CANiq72md+0Lerj+kqr6QiU6ySR3XjRzmuBiLjkpWWieM72wyeQ@xxxxxxxxxxxxxx/
Thanks for fixing the commit message and resending this!
Cheers,
Miguel