Re: [PATCH v7 1/1] rust: pci: add extended capability and SR-IOV support
[email protected] Tue, 04 Aug 2026 16:33:29 +0000
| Newsgroups | org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The struct `ExtSriovVfBars` is instantiated without the required `// INVARIANT:` comment. -- --- Patch [1]: [PATCH v7 1/1] rust: pci: add extended capability and SR-IOV support --- commit d31d2864003dad095e7db8d9a4e992599ece9365 Author: Zhi Wang <[email protected]> rust: pci: add extended capability and SR-IOV support This commit adds Rust abstractions for PCIe extended capabilities, specifically adding support for finding and parsing the SR-IOV extended capability and its VF BARs. Link: https://lore.kernel.org/rust-for-linux/[email protected]/ > diff --git a/rust/kernel/pci/cap.rs b/rust/kernel/pci/cap.rs > new file mode 100644 > index 0000000000000..c49de8682f6dd > --- /dev/null > +++ b/rust/kernel/pci/cap.rs [ ... ] > +struct ExtSriovVfBars { > + slots: [u32; NUM_VF_BARS], > + config_slot: usize, > +} > + > +impl ExtSriovVfBars { > + fn new(slots: [u32; NUM_VF_BARS]) -> Result<Self> { > + let mut config_slot = 0; > + > + while config_slot < NUM_VF_BARS { [ ... ] > + if is_64bit { > + if config_slot + 1 >= NUM_VF_BARS { > + return Err(EINVAL); > + } > + > + config_slot += 2; > + } else { > + config_slot += 1; > + } > + } > + > + Ok(Self { > + slots, > + config_slot: 0, > + }) [Severity: Low] This isn't a bug, but is it missing the required // INVARIANT: comment here? According to the Rust subsystem coding guidelines, when a struct with an # Invariants documentation section is constructed, the code should have an // INVARIANT: comment explaining why the invariants are satisfied, similar to a // SAFETY: comment. > + } > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1