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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 30 Jun 2022 14:44:52 +0200
From:   Pierre Morel <pmorel@...ux.ibm.com>
To:     Niklas Schnelle <schnelle@...ux.ibm.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>
Cc:     Jan Kiszka <jan.kiszka@...mens.com>,
        Matthew Rosato <mjrosato@...ux.ibm.com>,
        linux-s390@...r.kernel.org, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/5] PCI: Split out next_ari_fn() from next_fn()



On 6/28/22 16:30, Niklas Schnelle wrote:
> In commit b1bd58e448f2 ("PCI: Consolidate "next-function" functions")
> the next_fn() function subsumed the traditional and ARI based next
> function determination. This got rid of some needlessly complex function
> pointer handling but also reduced the separation between these very
> different methods of finding the next function. With the next_fn()
> cleaned up a bit we can re-introduce this separation by moving out the
> ARI handling while sticking with direct function calls.
> 
> Signed-off-by: Niklas Schnelle <schnelle@...ux.ibm.com>
> ---
>   drivers/pci/probe.c | 30 +++++++++++++++++-------------
>   1 file changed, 17 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index b05d0ed83a24..2c737dce757e 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2579,26 +2579,30 @@ struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn)
>   }
>   EXPORT_SYMBOL(pci_scan_single_device);
>   
> -static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn)
> +static int next_ari_fn(struct pci_bus *bus, struct pci_dev *dev, int fn)
>   {
>   	int pos;
>   	u16 cap = 0;
>   	unsigned int next_fn;
>   
> -	if (pci_ari_enabled(bus)) {
> -		if (!dev)
> -			return -ENODEV;
> -		pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
> -		if (!pos)
> -			return -ENODEV;
> +	if (!dev)
> +		return -ENODEV;
> +	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI);
> +	if (!pos)
> +		return -ENODEV;
> +
> +	pci_read_config_word(dev, pos + PCI_ARI_CAP, &cap);
> +	next_fn = PCI_ARI_CAP_NFN(cap);
> +	if (next_fn <= fn)
> +		return -ENODEV;	/* protect against malformed list */
>   
> -		pci_read_config_word(dev, pos + PCI_ARI_CAP, &cap);
> -		next_fn = PCI_ARI_CAP_NFN(cap);
> -		if (next_fn <= fn)
> -			return -ENODEV;	/* protect against malformed list */
> +	return next_fn;
> +}
>   
> -		return next_fn;
> -	}
> +static int next_fn(struct pci_bus *bus, struct pci_dev *dev, int fn)
> +{
> +	if (pci_ari_enabled(bus))
> +		return next_ari_fn(bus, dev, fn);
>   
>   	if (fn >= 7)
>   		return -ENODEV;
> 

Reviewed-by: Pierre Morel <pmorel@...ux.ibm.com>


-- 
Pierre Morel
IBM Lab Boeblingen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ