From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
stable@vger.kernel.org, tudor.ambarus@linaro.org,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
"Christian König" <christian.koenig@amd.com>,
"D Scott Phillips" <scott@os.amperecomputing.com>,
"Krzysztof Wilczyński" <kw@linux.com>, "Rio Liu" <rio@r26.me>
Subject: Re: [PATCH v2 1/3] PCI: Relaxed tail alignment should never increase min_align
Date: Thu, 21 Aug 2025 19:45:17 +0300 (EEST) [thread overview]
Message-ID: <21e11870-f125-e9e7-04f3-ade94d6be6b1@linux.intel.com> (raw)
In-Reply-To: <8e9936e5-d720-4ded-8961-b9475aeb2ac7@web.de>
[-- Attachment #1: Type: text/plain, Size: 964 bytes --]
On Thu, 21 Aug 2025, Markus Elfring wrote:
> …
> > Ensure min_align is not increased by the relaxed tail alignment.
> …
>
>
> …
> +++ b/drivers/pci/setup-bus.c
> …
> @@ -1261,8 +1263,9 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
> if (bus->self && size1 &&
> !pbus_upstream_space_available(bus, mask | IORESOURCE_PREFETCH, type,
> size1, add_align)) {
> - min_align = 1ULL << (max_order + __ffs(SZ_1M));
> - min_align = max(min_align, win_align);
> + relaxed_align = 1ULL << (max_order + __ffs(SZ_1M));
> + relaxed_align = max(min_align, win_align);
> …
>
> I wonder why a variable content would be overwritten here
> without using the previous value.
> https://cwe.mitre.org/data/definitions/563.html
Hi Markus,
This looks a very good catch. I think it too should have been:
relaxed_align = max(relaxed_align, win_align);
...like in the other case.
--
i.
next prev parent reply other threads:[~2025-08-21 16:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 14:26 [PATCH v2 0/3] PCI: Resource fitting algorith fixes Ilpo Järvinen
2025-06-30 14:26 ` [PATCH v2 1/3] PCI: Relaxed tail alignment should never increase min_align Ilpo Järvinen
2025-08-21 15:10 ` Bjorn Helgaas
2025-08-21 15:15 ` Ilpo Järvinen
2025-08-21 15:24 ` Ilpo Järvinen
2025-08-21 15:47 ` Bjorn Helgaas
2025-08-21 16:28 ` Markus Elfring
2025-08-21 16:45 ` Ilpo Järvinen [this message]
2025-08-21 17:00 ` Markus Elfring
2025-06-30 14:26 ` [PATCH v2 2/3] PCI: Fix pdev_resources_assignable() disparity Ilpo Järvinen
2025-08-21 15:11 ` Bjorn Helgaas
2025-08-21 15:21 ` Ilpo Järvinen
2025-06-30 14:26 ` [PATCH v2 3/3] PCI: Fix failure detection during resource resize Ilpo Järvinen
2025-08-21 15:14 ` Bjorn Helgaas
2025-08-21 15:22 ` Ilpo Järvinen
2025-07-23 13:07 ` [PATCH v2 0/3] PCI: Resource fitting algorith fixes Ilpo Järvinen
2025-08-21 14:58 ` Ilpo Järvinen
2025-08-21 15:17 ` Bjorn Helgaas
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=21e11870-f125-e9e7-04f3-ade94d6be6b1@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Markus.Elfring@web.de \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rio@r26.me \
--cc=scott@os.amperecomputing.com \
--cc=stable@vger.kernel.org \
--cc=tudor.ambarus@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).