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: <20240818.021341.1481957326827323675.fujita.tomonori@gmail.com>
Date: Sun, 18 Aug 2024 02:13:41 +0000 (UTC)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: benno.lossin@...ton.me
Cc: fujita.tomonori@...il.com, netdev@...r.kernel.org,
 rust-for-linux@...r.kernel.org, andrew@...n.ch, tmgross@...ch.edu,
 miguel.ojeda.sandonis@...il.com, aliceryhl@...gle.com
Subject: Re: [PATCH net-next v4 3/6] rust: net::phy implement
 AsRef<kernel::device::Device> trait

On Sat, 17 Aug 2024 13:30:15 +0000
Benno Lossin <benno.lossin@...ton.me> wrote:

>> +impl AsRef<kernel::device::Device> for Device {
>> +    fn as_ref(&self) -> &kernel::device::Device {
>> +        let phydev = self.0.get();
>> +        // SAFETY: The struct invariant ensures that we may access
>> +        // this field without additional synchronization.
> 
> I don't see this invariant on `phy::Device`.

You meant that `phy::Device` Invariants says that all methods defined
on this struct are safe to call; not about accessing a field so the
above SAFETY comment isn't correct, right?

> ---
> Cheers,
> Benno
> 
>> +        unsafe { kernel::device::Device::as_ref(addr_of_mut!((*phydev).mdio.dev)) }
>> +    }
>> +}

SAFETY: A valid `phy_device` always have a valid `mdio.dev`.

Better?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ