[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170424103658.GU7152@lahna.fi.intel.com>
Date: Mon, 24 Apr 2017 13:36:58 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Pan Bian <bianpan201603@....com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Lukas Wunner <lukas@...ner.de>,
Keith Busch <keith.busch@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Pan Bian <bianpan2016@....com>
Subject: Re: [PATCH 1/1] PCI: check return value of pci_find_ext_capability
On Sun, Apr 23, 2017 at 10:00:20PM +0800, Pan Bian wrote:
> From: Pan Bian <bianpan2016@....com>
>
> Function pci_find_ext_capability() will returns 0 on failure, and its
> return value should be checked before it is used. However, in function
> pcie_port_enable_msix(), its return value is not checked. This patch
> adds the check.
>
> Signed-off-by: Pan Bian <bianpan2016@....com>
> ---
> drivers/pci/pcie/portdrv_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> index cea504f..001951d 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -103,6 +103,8 @@ static int pcie_port_enable_msix(struct pci_dev *dev, int *irqs, int mask)
> * interrupt message."
> */
> pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
> + if (!pos)
> + goto out_free_irqs;
I don't think this can happen because get_port_device_capability() will
enumerate this capability and only if it exists, set PCIE_PORT_SERVICE_AER.
Powered by blists - more mailing lists