From: "Krzysztof Wilczyński" <kw@linux.com>
To: Ziming Du <duziming2@huawei.com>
Cc: bhelgaas@google.com, alex@shazbot.org, chrisw@redhat.com,
jbarnes@virtuousgeek.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, liuyongqiang13@huawei.com
Subject: Re: [PATCH] PCI/sysfs: Prohibit unaligned access to I/O port
Date: Mon, 4 May 2026 05:31:00 +0900 [thread overview]
Message-ID: <20260503200256.GA1393215@rocinante> (raw)
In-Reply-To: <20260408095532.1192625-1-duziming2@huawei.com>
Hello,
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 16eaaf749ba97..c88910bcad262 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -31,6 +31,7 @@
> #include <linux/of.h>
> #include <linux/aperture.h>
> #include <linux/unaligned.h>
> +#include <linux/align.h>
> #include "pci.h"
The "pci.h" header includes "linux/align.h" already.
> #ifndef ARCH_PCI_DEV_GROUPS
> @@ -1157,6 +1158,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
> if (port + count - 1 > pci_resource_end(pdev, bar))
> return -EINVAL;
>
> + if (!IS_ALIGNED(port, count))
> + return -EINVAL;
> +
> switch (count) {
> case 1:
> if (write)
Otherwise:
Reviewed-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Thank you!
Krzysztof
prev parent reply other threads:[~2026-05-03 20:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 9:55 [PATCH] PCI/sysfs: Prohibit unaligned access to I/O port Ziming Du
2026-04-08 10:02 ` Ilpo Järvinen
2026-04-09 8:09 ` Ilpo Järvinen
2026-05-03 20:31 ` Krzysztof Wilczyński [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=20260503200256.GA1393215@rocinante \
--to=kw@linux.com \
--cc=alex@shazbot.org \
--cc=bhelgaas@google.com \
--cc=chrisw@redhat.com \
--cc=duziming2@huawei.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liuyongqiang13@huawei.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