lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce990cdf-f279-466d-b402-d98e4a75edb3@kernel.org>
Date: Wed, 2 Jul 2025 12:36:13 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: 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>,
 Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Bjorn Helgaas <bhelgaas@...gle.com>,
 Mika Westerberg <mika.westerberg@...ux.intel.com>,
 Ying Huang <huang.ying.caritas@...il.com>, Benno Lossin <lossin@...nel.org>,
 linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v11 4/4] rust: platform: allow ioremap of platform
 resources

On 7/1/25 4:34 PM, Daniel Almeida wrote:
> +impl Device<device::Bound> {

<snip>

> +    pub fn iomap_resource_sized<const SIZE: usize>(
> +        &self,
> +        resource: &Resource,
> +    ) -> Result<impl PinInit<Devres<IoMem<SIZE>>, Error> + '_> {
> +        IoMem::new(resource, self.as_ref())
> +    }

Sorry that I did not catch this earlier, but what if I supply a Resource here
that has *not* been obtained by any of the platform::Device methods and from the
same platform::Device as you call this function for?

I think this also needs something similar to what we do in the IRQ abstraction,
e.g.:

	/// # Invariants
	///
	/// `res` has been obtained from `dev`.
	pub struct IoRequest<'a> {
	   dev: &'a Device<Bound>,
	   res: &'a Resource,
	}

Such that IoMem::new() can take an IoRequest instance instead.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ