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: <DB77AQ53YOFK.VBSAP1H7FFB9@umich.edu>
Date: Tue, 08 Jul 2025 23:23:20 -0400
From: "Trevor Gross" <tmgross@...ch.edu>
To: "FUJITA Tomonori" <fujita.tomonori@...il.com>, <alex.gaynor@...il.com>,
 <dakr@...nel.org>, <gregkh@...uxfoundation.org>, <ojeda@...nel.org>,
 <rafael@...nel.org>, <robh@...nel.org>, <saravanak@...gle.com>
Cc: <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>
Subject: Re: [PATCH v3 2/3] rust: net::phy represent DeviceId as transparent
 wrapper over mdio_device_id

On Fri Jul 4, 2025 at 12:10 AM EDT, FUJITA Tomonori wrote:
> Refactor the DeviceId struct to be a #[repr(transparent)] wrapper
> around the C struct bindings::mdio_device_id.
>
> This refactoring is a preparation for enabling the PHY abstractions to
> use device_id trait.

Should this say "the `DeviceId` trait" (different case)?

> Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
> ---
>  rust/kernel/net/phy.rs | 53 +++++++++++++++++++++---------------------
>  1 file changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
> index 65ac4d59ad77..940972ffadae 100644
> --- a/rust/kernel/net/phy.rs
> +++ b/rust/kernel/net/phy.rs
> [...]
> @@ -734,18 +733,20 @@ pub const fn new_with_driver<T: Driver>() -> Self {
>          T::PHY_DEVICE_ID
>      }
>  
> +    /// Get a `phy_id` as u32.
> +    pub const fn id(&self) -> u32 {
> +        self.0.phy_id
> +    }

For the docs maybe just:

    /// Get the MDIO device's phy ID.

Since `as u32` is slightly redundant (it's in the return type, and that
is how it is stored anyway).

>      /// Get a `mask` as u32.
>      pub const fn mask_as_int(&self) -> u32 {
> -        self.mask.as_int()
> +        self.0.phy_id_mask
>      }

One optional nit then:

Reviewed-by: Trevor Gross <tmgross@...ch.edu>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ