lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 8 Dec 2022 13:03:39 -0600 From: Bjorn Helgaas <helgaas@...nel.org> To: linux-pci@...r.kernel.org Cc: Hans de Goede <hdegoede@...hat.com>, Florent DELAHAYE <kernelorg@...ead.fr>, Konrad J Hambrick <kjhambrick@...il.com>, Matt Hansen <2lprbe78@...k.com>, Benoit Grégoire <benoitg@...us.ca>, Nicholas Johnson <nicholas.johnson-opensource@...look.com.au>, Mika Westerberg <mika.westerberg@...ux.intel.com>, Werner Sembach <wse@...edocomputers.com>, mumblingdrunkard@...tonmail.com, linux-kernel@...r.kernel.org, Bjorn Helgaas <bhelgaas@...gle.com> Subject: [PATCH v2 2/4] PCI: Skip allocate_resource() if too little space available From: Bjorn Helgaas <bhelgaas@...gle.com> pci_bus_alloc_from_region() allocates MMIO space by iterating through all the resources available on the bus. The available resource might be reduced if the caller requires 32-bit space or we're avoiding BIOS or E820 areas. Don't bother calling allocate_resource() if we need more space than is available in this resource. This prevents some pointless and annoying messages about avoided areas. Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com> Cc: Hans de Goede <hdegoede@...hat.com> --- drivers/pci/bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 3cef835b375f..83ae838ceb5f 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -197,6 +197,10 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, max = avail.end; + /* Don't bother if available space isn't large enough */ + if (size > max - min_used + 1) + continue; + /* Ok, try it out.. */ ret = allocate_resource(r, res, size, min_used, max, align, alignf, alignf_data); -- 2.25.1
Powered by blists - more mailing lists