[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72=b=Z+6dk4XWK6QWcKDJx7SYXL0obAFFfWp8xpE1CFkkw@mail.gmail.com>
Date: Tue, 20 Jan 2026 13:58:33 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Navaneeth K <knavaneeth786@...il.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] rust: kernel: document safety for rust_fmt_argument
On Sat, Nov 22, 2025 at 8:09 PM Navaneeth K <knavaneeth786@...il.com> wrote:
>
> + // SAFETY: The caller guarantees that `ptr` points to a valid `fmt::Arguments`.
Thanks for the patch!
The caller is indeed supposed to pass a proper `ptr`, but we should
actually require it, i.e. this line above:
#[expect(clippy::missing_safety_doc)]
should be replaced with docs with a `# Safety` section that requires
it so that then we can apply the guarantee as you did in the `//
SAFETY:` doc.
Also, in addition to that parameter, we should double-check we put
enough safety preconditions on the other parameters. If we do that,
then we could also update the "C contract guarantees" safety comment
too to just refer to those.
(We could perhaps even mention in the C header that the safety
preconditions are written in the Rust docs for completeness.)
Cheers,
Miguel
Powered by blists - more mailing lists