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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9d4ab150-0006-40a9-9056-71c16971d928@linux.intel.com>
Date: Tue, 10 Jun 2025 07:28:11 -0700
From: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...ux.intel.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 Krzysztof Wilczyński <kw@...ux.com>,
 Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] PCI: Cleanup pci_scan_child_bus_extend() loop


On 6/10/25 3:58 AM, Ilpo Järvinen wrote:
> pci_scan_child_bus_extend() open-codes device number iteration in the
> for loop. Convert to use PCI_DEVFN() and add PCI_MAX_NR_DEVS (there
> seems to be no pre-existing defines for this purpose).
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>

>   drivers/pci/pci.h   | 1 +
>   drivers/pci/probe.c | 6 +++---
>   2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 12215ee72afb..caa6e02a9aea 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -8,6 +8,7 @@ struct pcie_tlp_log;
>   
>   /* Number of possible devfns: 0.0 to 1f.7 inclusive */
>   #define MAX_NR_DEVFNS 256
> +#define PCI_MAX_NR_DEVS	32
>   
>   #define MAX_NR_LANES 16
>   
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index f08e754c404b..963cab481327 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -3029,14 +3029,14 @@ static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
>   {
>   	unsigned int used_buses, normal_bridges = 0, hotplug_bridges = 0;
>   	unsigned int start = bus->busn_res.start;
> -	unsigned int devfn, cmax, max = start;
> +	unsigned int devnr, cmax, max = start;
>   	struct pci_dev *dev;
>   
>   	dev_dbg(&bus->dev, "scanning bus\n");
>   
>   	/* Go find them, Rover! */
> -	for (devfn = 0; devfn < 256; devfn += 8)
> -		pci_scan_slot(bus, devfn);
> +	for (devnr = 0; devnr < PCI_MAX_NR_DEVS; devnr++)
> +		pci_scan_slot(bus, PCI_DEVFN(devnr, 0));
>   
>   	/* Reserve buses for SR-IOV capability */
>   	used_buses = pci_iov_bus_range(bus);

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ