[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DBCHDKA3SV70.1N60UYLTM58OB@kernel.org>
Date: Tue, 15 Jul 2025 10:20:34 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Daniel Almeida" <daniel.almeida@...labora.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Benno Lossin"
<lossin@...nel.org>, "Andreas Hindborg" <a.hindborg@...nel.org>, "Trevor
Gross" <tmgross@...ch.edu>, "Greg Kroah-Hartman"
<gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
<linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v13 2/3] rust: io: mem: add a generic iomem abstraction
On Tue Jul 15, 2025 at 10:12 AM CEST, Alice Ryhl wrote:
>> + {
>> + // SAFETY:
>> + // - `res_start` and `size` are read from a presumably valid `struct resource`.
>> + // - `size` is known not to be zero at this point.
>> + unsafe { bindings::ioremap_np(res_start, size.try_into()?) }
>> + } else {
>> + // SAFETY:
>> + // - `res_start` and `size` are read from a presumably valid `struct resource`.
>> + // - `size` is known not to be zero at this point.
>> + unsafe { bindings::ioremap(res_start, size.try_into()?) }
>
> I thought a bit more about this, and I think it's fine for these sizes to
> be converted with try_into()?.
Fine for me too, but we should add a comment with a TODO to get this straight
in the future.
Powered by blists - more mailing lists