Re: [PATCH v2 1/3] PCI: Relaxed tail alignment should never increase min_align

From: Markus Elfring
Date: Thu Aug 21 2025 - 12:33:39 EST



> 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

Regards,
Markus