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: <DB6KIR4X6GKM.3EJYQJXILGOGN@kernel.org>
Date: Tue, 08 Jul 2025 11:32:24 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alistair Popple" <apopple@...dia.com>
Cc: <rust-for-linux@...r.kernel.org>, "Bjorn Helgaas" <bhelgaas@...gle.com>,
 Krzysztof Wilczyński <kwilczynski@...nel.org>, "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>, "Benno Lossin"
 <lossin@...nel.org>, "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>, "John Hubbard" <jhubbard@...dia.com>, "Alexandre
 Courbot" <acourbot@...dia.com>, <linux-pci@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] rust: Add several miscellaneous PCI helpers

On Tue Jul 8, 2025 at 8:04 AM CEST, Alistair Popple wrote:
> diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs
> index 7f640ba8f19c..f41fd9facb90 100644
> --- a/rust/kernel/pci.rs
> +++ b/rust/kernel/pci.rs
> @@ -393,6 +393,42 @@ pub fn device_id(&self) -> u16 {
>          unsafe { (*self.as_raw()).device }
>      }
>  
> +    /// Returns the PCI revision ID.
> +    pub fn revision_id(&self) -> u8 {

We should add a compiler hint for those methods to be inlined.

> +        // SAFETY: `self.as_raw` is a valid pointer to a `struct pci_dev`.

Let's refer to the type invariant for the validity of self.as_raw().

> +        unsafe { (*self.as_raw()).revision }
> +    }

Both is also true for the existing methods vendor_id() and device_id(). Can you
please fix them up in a separate patch as well?

Also, please add a brief note in the commit message where those will be used
(even though I obviously know). :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ