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: <aGckCY3BiPRCPmS7@pollux>
Date: Fri, 4 Jul 2025 02:44:57 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: alex.gaynor@...il.com, gregkh@...uxfoundation.org, ojeda@...nel.org,
	rafael@...nel.org, robh@...nel.org, saravanak@...gle.com,
	a.hindborg@...nel.org, aliceryhl@...gle.com, bhelgaas@...gle.com,
	bjorn3_gh@...tonmail.com, boqun.feng@...il.com,
	david.m.ertman@...el.com, devicetree@...r.kernel.org,
	gary@...yguo.net, ira.weiny@...el.com, kwilczynski@...nel.org,
	leon@...nel.org, linux-kernel@...r.kernel.org,
	linux-pci@...r.kernel.org, lossin@...nel.org,
	netdev@...r.kernel.org, rust-for-linux@...r.kernel.org,
	tmgross@...ch.edu
Subject: Re: [PATCH v2 1/3] rust: device_id: split out index support into a
 separate trait

On Tue, Jul 01, 2025 at 11:12:50PM +0900, FUJITA Tomonori wrote:
> +// SAFETY:
> +// * `DRIVER_DATA_OFFSET` is the offset to the `driver_data` field.

Here and for a few other occurances, this doesn't need to be a list, since it's
just a single item.

> +/// Extension trait for [`RawDeviceId`] for devices that embed an index or context value.
> +///
> +/// This is typically used when the device ID struct includes a field like `driver_data`
> +/// that is used to store a pointer-sized value (e.g., an index or context pointer).
> +///
> +/// # Safety
> +///
> +/// Implementers must ensure that:
> +///   - `DRIVER_DATA_OFFSET` is the correct offset (in bytes) to the context/data field (e.g., the
> +///     `driver_data` field) within the raw device ID structure. This field must be correctly sized
> +///     to hold a `usize`.
> +///
> +///     Ideally, the data should ideally be added during `Self` to `RawType` conversion,

Remove one of the duplicate "ideally".

> +///     but there's currently no way to do it when using traits in const.
> +///
> +///   - The `index` method must return the value stored at the location specified
> +///     by `DRIVER_DATA_OFFSET`, assuming `self` is layout-compatible with `RawType`.

I think technically this safety requirement isn't needed.

With this:

	Acked-by: Danilo Krummrich <dakr@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ