From: Markus Elfring <Markus.Elfring@web.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>
Cc: stable@vger.kernel.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>,
"Tudor Ambarus" <tudor.ambarus@linaro.org>
Subject: Re: [PATCH v2 1/3] PCI: Relaxed tail alignment should never increase min_align
Date: Thu, 21 Aug 2025 19:00:10 +0200 [thread overview]
Message-ID: <0185a58e-9211-4c10-bcf2-bbf2f566323e@web.de> (raw)
In-Reply-To: <21e11870-f125-e9e7-04f3-ade94d6be6b1@linux.intel.com>
>> …
>> +++ 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
…> 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.
Did any known source code analysis tools point such a questionable implementation detail out
for further development considerations?
Regards,
Markus
next prev parent reply other threads:[~2025-08-21 17:00 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
2025-08-21 17:00 ` Markus Elfring [this message]
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=0185a58e-9211-4c10-bcf2-bbf2f566323e@web.de \
--to=markus.elfring@web.de \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=ilpo.jarvinen@linux.intel.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
all inboxes | Powered by JetHome®