From: sashiko-bot@kernel.org
To: "Farhan Ali" <alifm@linux.ibm.com>
Cc: "Heiko Carstens" <hca@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-pci@vger.kernel.org,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH v20 2/4] PCI: Avoid saving config space state if inaccessible
Date: Mon, 22 Jun 2026 17:29:19 +0000 [thread overview]
Message-ID: <20260622172920.50B091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622171840.1618-3-alifm@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `msg` parameter in `pci_dev_config_accessible` is declared as `char *` but is passed string literals.
--
commit 9495eb9f8f7d4d9784f1bb256b565bf60e0d2bb7
Author: Farhan Ali <alifm@linux.ibm.com>
PCI: Avoid saving config space state if inaccessible
This commit modifies the device reset process to check if the device's
configuration space is accessible before attempting to save its state. If
the space is inaccessible, it skips saving to prevent invalid values from
being written back during state restoration.
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index d0c9f0166af5c..e71b814153921 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
[ ... ]
> @@ -722,6 +722,27 @@ u16 pci_find_dvsec_capability(struct pci_dev *dev, u16 vendor, u16 dvsec)
> }
> EXPORT_SYMBOL_GPL(pci_find_dvsec_capability);
>
> +static bool pci_dev_config_accessible(struct pci_dev *dev, char *msg)
[Severity: Low]
This isn't a bug, but could the msg parameter be declared as const char *
instead?
This function is passed string literals like "save state" when called from
pci_dev_save_and_disable(), and using a const pointer would ensure
const-correctness and help prevent potential compiler warnings.
> +{
> + u32 val;
> +
> + /*
> + * If device's config space is inaccessible it can return ~0 for
> + * any reads. Since VFs can also return ~0 for Device and Vendor ID
> + * check Command and Status registers. Note that this is racy
> + * because the device may become inaccessible partway through
> + * next access.
> + */
> + pci_read_config_dword(dev, PCI_COMMAND, &val);
> + if (PCI_POSSIBLE_ERROR(val)) {
> + pci_warn(dev, "Device config space inaccessible; unable to %s\n",
> + msg);
> + return false;
> + }
> +
> + return true;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260622171840.1618-1-alifm@linux.ibm.com?part=2
next prev parent reply other threads:[~2026-06-22 17:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 17:18 [PATCH v20 0/4] [PCI] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-06-22 17:18 ` [PATCH v20 1/4] PCI: Allow per function PCI slots to fix slot reset on s390 Farhan Ali
2026-06-22 17:32 ` sashiko-bot
2026-06-22 17:18 ` [PATCH v20 2/4] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-06-22 17:29 ` sashiko-bot [this message]
2026-06-22 17:18 ` [PATCH v20 3/4] PCI: Fail FLR when config space is inaccessible Farhan Ali
2026-06-22 17:27 ` sashiko-bot
2026-06-22 17:18 ` [PATCH v20 4/4] PCI/MSI: Enable memory decoding before restoring MSI-X messages Farhan Ali
2026-06-22 17:30 ` sashiko-bot
2026-06-22 18:54 ` Niklas Schnelle
2026-06-22 20:22 ` Farhan Ali
2026-06-22 20:29 ` Thomas Gleixner
2026-06-22 20:49 ` Farhan Ali
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=20260622172920.50B091F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=alifm@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.