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:   Tue, 12 Oct 2021 11:02:20 -0400
From:   Alyssa Rosenzweig <alyssa@...enzweig.io>
To:     Colin King <colin.king@...onical.com>
Cc:     Marc Zyngier <maz@...nel.org>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Rob Herring <robh@...nel.org>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] PCI: apple: Remove redundant initialization of
 pointer port_pdev

It looks like 

        port_pdev = pcie_find_root_port(pdev);

might've meant to read

        port_pdev = pcie_find_root_port(port_pdev);

in which case the assignment would be used. I have no strong opinions
either way.

Full context for those following along at home:

```
static struct apple_pcie_port *apple_pcie_get_port(struct pci_dev *pdev)
{
        struct pci_config_window *cfg = pdev->sysdata;
        struct apple_pcie *pcie = cfg->priv;
        struct pci_dev *port_pdev = pdev;
        struct apple_pcie_port *port;

        /* Find the root port this device is on */
        port_pdev = pcie_find_root_port(pdev);

        /* If finding the port itself, nothing to do */
        if (WARN_ON(!port_pdev) || pdev == port_pdev)
                return NULL;

        list_for_each_entry(port, &pcie->ports, entry) {
                if (port->idx == PCI_SLOT(port_pdev->devfn))
                        return port;
        }

        return NULL;
}
```

On Tue, Oct 12, 2021 at 02:32:35PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> The pointer port_pdev is being initialized with a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/pci/controller/pcie-apple.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
> index b4db7a065553..19fd2d38aaab 100644
> --- a/drivers/pci/controller/pcie-apple.c
> +++ b/drivers/pci/controller/pcie-apple.c
> @@ -634,7 +634,7 @@ static struct apple_pcie_port *apple_pcie_get_port(struct pci_dev *pdev)
>  {
>  	struct pci_config_window *cfg = pdev->sysdata;
>  	struct apple_pcie *pcie = cfg->priv;
> -	struct pci_dev *port_pdev = pdev;
> +	struct pci_dev *port_pdev;
>  	struct apple_pcie_port *port;
>  
>  	/* Find the root port this device is on */
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ