All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Alice Ryhl" <aliceryhl@google.com>
Cc: "Daniel Almeida" <daniel.almeida@collabora.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v13 2/3] rust: io: mem: add a generic iomem abstraction
Date: Tue, 15 Jul 2025 10:20:34 +0200	[thread overview]
Message-ID: <DBCHDKA3SV70.1N60UYLTM58OB@kernel.org> (raw)
In-Reply-To: <aHYNeEjQXz3CxfEM@google.com>

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.

  reply	other threads:[~2025-07-15  8:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11 22:32 [PATCH v13 0/3] rust: platform: add Io support Daniel Almeida
2025-07-11 22:32 ` [PATCH v13 1/3] rust: io: add resource abstraction Daniel Almeida
2025-07-15  8:03   ` Alice Ryhl
2025-07-16 16:52     ` Daniel Almeida
2025-07-16 17:04       ` Alice Ryhl
2025-07-16 17:10       ` Danilo Krummrich
2025-07-11 22:32 ` [PATCH v13 2/3] rust: io: mem: add a generic iomem abstraction Daniel Almeida
2025-07-13  7:57   ` kernel test robot
2025-07-15  8:12   ` Alice Ryhl
2025-07-15  8:20     ` Danilo Krummrich [this message]
2025-07-11 22:32 ` [PATCH v13 3/3] rust: platform: add resource accessors Daniel Almeida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DBCHDKA3SV70.1N60UYLTM58OB@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.