[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0185a58e-9211-4c10-bcf2-bbf2f566323e@web.de>
Date: Thu, 21 Aug 2025 19:00:10 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
linux-pci@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com>
Cc: stable@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org, Christian König
<christian.koenig@....com>, D Scott Phillips <scott@...amperecomputing.com>,
Krzysztof Wilczyński <kw@...ux.com>, Rio Liu <rio@....me>,
Tudor Ambarus <tudor.ambarus@...aro.org>
Subject: Re: [PATCH v2 1/3] PCI: Relaxed tail alignment should never increase
min_align
>> …
>> +++ 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
Powered by blists - more mailing lists