Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zhi Wang" <zhiw@nvidia.com>
Cc: linux-pci@vger.kernel.org, ojeda@kernel.org
Subject: Re: [PATCH v7 1/1] rust: pci: add extended capability and SR-IOV support
Date: Tue, 04 Aug 2026 16:33:29 +0000	[thread overview]
Message-ID: <20260804163329.D860B1F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260804161612.776752-2-zhiw@nvidia.com>

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 <zhiw@nvidia.com>

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/20260730182954.783568-1-zhiw@nvidia.com/

> 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/20260804161612.776752-2-zhiw@nvidia.com?part=1

  reply	other threads:[~2026-08-04 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 16:16 [PATCH v7 0/1] Rust PCI capability infrastructure and SR-IOV support Zhi Wang
2026-08-04 16:16 ` [PATCH v7 1/1] rust: pci: add extended capability " Zhi Wang
2026-08-04 16:33   ` sashiko-bot [this message]
2026-08-13 13:04   ` Gary Guo
2026-08-13 13:56   ` Danilo Krummrich
2026-08-13  6:54 ` [PATCH v7 0/1] Rust PCI capability infrastructure " Zhi Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804163329.D860B1F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhiw@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox