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] [day] [month] [year] [list]
Message-Id: <20250704.121208.1554239479866226095.fujita.tomonori@gmail.com>
Date: Fri, 04 Jul 2025 12:12:08 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: dakr@...nel.org
Cc: fujita.tomonori@...il.com, 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 Fri, 4 Jul 2025 02:44:57 +0200
Danilo Krummrich <dakr@...nel.org> wrote:

> 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.

Indeed, fixed all the places.


>> +/// 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".

Oops, removed.


>> +///     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.

Ah, you're right. I'll remove it.


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

Thanks a lot!


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ