Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yazen Ghannam" <yazen.ghannam@amd.com>, linux-pci@vger.kernel.org
Subject: Re: [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero
Date: Tue, 10 Nov 2026 22:02:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-207809@kernel.org> (raw)
In-Reply-To: <20261110215614.3931232-3-yazen.ghannam@amd.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] PCI/AER: incorrect unit scaling in
  aer_ratelimit_interval_attr() [1]
--

commit 3e212613eb554aa7ec8ef93c898bf101c6bb444e
Author: Yazen Ghannam <yazen.ghannam@amd.com>

PCI/AER: Clamp negative ratelimit burst to zero

This commit clamps negative values written to the AER ratelimit burst sysfs
attributes to zero and updates the ABI documentation accordingly.

> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 6f24602314225..401cd3a1b3d0e 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -752,6 +752,9 @@ const struct attribute_group aer_stats_attr_group = {
>  		if (kstrtoint(buf, 0, &burst) < 0)			\
>  			return -EINVAL;					\
>  									\
> +		if (burst < 0)						\
> +			burst = 0;					\
> +									\
>  		pdev->aer_info->ratelimit.burst = burst;		\
>  									\
>  		return count;						\

[Severity: Medium]
This problem wasn't introduced by this patch, but shouldn't the companion
aer_ratelimit_interval_attr() macro convert pdev->aer_info->ratelimit.interval
back with jiffies_to_msecs() in name##_show() [1]?

drivers/pci/pcie/aer.c:aer_ratelimit_interval_attr() {
	static ssize_t							\
	name##_show(struct device *dev, struct device_attribute *attr,	\
					 char *buf)			\
	{								\
		struct pci_dev *pdev = to_pci_dev(dev);			\
									\
		return sysfs_emit(buf, "%d\n",				\
				  pdev->aer_info->ratelimit.interval);	\
	}								\
    ...
		if (interval <= 0)					\
			interval = 0;					\
		else							\
			interval = msecs_to_jiffies(interval); 		\
									\
		pdev->aer_info->ratelimit.interval = interval;		\
}

name##_store() converts the millisecond value into jiffies before storing it,
so reading *_ratelimit_interval_ms back emits raw jiffies instead of
milliseconds when HZ != 1000.

[1] https://sashiko.dev/#/bug/linux-3e0972eb-98a1-4365-b40e-82736dd85f13

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110215614.3931232-1-yazen.ghannam@amd.com?part=2

  reply	other threads:[~2026-11-10 22:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 21:56 [PATCH 0/4] AER sysfs fixes Yazen Ghannam
2026-11-10 21:56 ` [PATCH 1/4] MAINTAINERS: Add the AER sysfs ABI file to PCI SUBSYSTEM Yazen Ghannam
2026-11-10 21:56 ` [PATCH 2/4] PCI/AER: Clamp negative ratelimit burst to zero Yazen Ghannam
2026-11-10 22:02   ` sashiko-bot [this message]
2026-11-10 22:11     ` Yazen Ghannam
2026-11-10 21:56 ` [PATCH 3/4] PCI/AER: Report the ratelimit interval in milliseconds Yazen Ghannam
2026-11-10 22:00   ` sashiko-bot
2026-11-10 21:56 ` [PATCH 4/4] PCI/AER: Hide the "aer" sysfs directory on devices without AER Yazen Ghannam
2026-11-10 22:00   ` sashiko-bot

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=sashiko-outbox-207809@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yazen.ghannam@amd.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