Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1630931 > unrolled thread
| Started by | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| First post | 2017-04-25 21:40 +0200 |
| Last post | 2017-04-25 21:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 1/1] PCI: check return value of pci_find_ext_capability Bjorn Helgaas <helgaas@kernel.org> - 2017-04-25 21:40 +0200
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-04-25 21:40 +0200 |
| Subject | Re: [PATCH 1/1] PCI: check return value of pci_find_ext_capability |
| Message-ID | <tAetA-r0-9@gated-at.bofh.it> |
On Mon, Apr 24, 2017 at 01:36:58PM +0300, Mika Westerberg wrote: > On Sun, Apr 23, 2017 at 10:00:20PM +0800, Pan Bian wrote: > > From: Pan Bian <bianpan2016@163.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@163.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. The path is more complicated than I'd like, but I think you're right. We should also be able to use dev->aer_cap here instead of looking it up again. Bjorn
Back to top | Article view | linux.kernel
csiph-web