Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1629030
| From | Pan Bian <bianpan201603@163.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/1] PCI: check return value of pci_find_ext_capability |
| Date | 2017-04-23 16:10 +0200 |
| Message-ID | <tzqn7-148-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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; pci_read_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, ®32); entry = reg32 >> 27; if (entry >= nr_entries) -- 1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/1] PCI: check return value of pci_find_ext_capability Pan Bian <bianpan201603@163.com> - 2017-04-23 16:10 +0200 Re: [PATCH 1/1] PCI: check return value of pci_find_ext_capability Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-04-24 12:40 +0200
csiph-web