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 v8 1/1] rust: pci: add extended capability and SR-IOV support
Date: Tue, 18 Aug 2026 08:55:38 +0000	[thread overview]
Message-ID: <20260818085539.910201F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818084633.1673214-2-zhiw@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `ExtSriovVfBars` struct is constructed without an `// INVARIANT:` comment explaining why its invariants are satisfied.
--

--- Patch [1]: [PATCH v8 1/1] rust: pci: add extended capability and SR-IOV support ---
commit e0446bc8a9435cb9072472f040f7215e21d10ce1
Author: Zhi Wang <zhiw@nvidia.com>

rust: pci: add extended capability and SR-IOV support

This commit adds Rust PCI abstractions for locating and accessing PCIe
extended capabilities. It provides specific support for the SR-IOV
extended capability and a decoded VF BAR iterator.

Link: https://lore.kernel.org/rust-for-linux/20260804161612.776752-1-zhiw@nvidia.com/

> diff --git a/rust/kernel/pci/cap.rs b/rust/kernel/pci/cap.rs
> new file mode 100644
> index 0000000000000..ddb3fd73e1955
> --- /dev/null
> +++ b/rust/kernel/pci/cap.rs

[ ... ]

> +struct ExtSriovVfBars {
> +    bars: [ExtSriovVfBar; NUM_VF_BARS],
> +    bar_count: usize,
> +    next_bar: usize,
> +}
> +
> +impl ExtSriovVfBars {
> +    fn new(slots: [u32; NUM_VF_BARS]) -> Result<Self> {

[ ... ]

> +            bars[bar_count] = ExtSriovVfBar { address, is_64bit };
> +            bar_count += 1;
> +        }
> +
> +        Ok(Self {
> +            bars,
> +            bar_count,
> +            next_bar: 0,
> +        })

[Severity: Low]
This isn't a bug, but the Rust subsystem guidelines require an // INVARIANT:
comment when constructing a struct that has documented invariants.
ExtSriovVfBars documents its invariants above, but is constructed here
without explaining how they are satisfied. Could an // INVARIANT: comment
be added here?

> +    }
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818084633.1673214-2-zhiw@nvidia.com?part=1

      reply	other threads:[~2026-08-18  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  8:46 [PATCH v8 0/1] Rust PCI capability infrastructure and SR-IOV support Zhi Wang
2026-08-18  8:46 ` [PATCH v8 1/1] rust: pci: add extended capability " Zhi Wang
2026-08-18  8:55   ` sashiko-bot [this message]

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=20260818085539.910201F000E9@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