From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Pan Bian <bianpan201603@163.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Lukas Wunner <lukas@wunner.de>,
Keith Busch <keith.busch@intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Pan Bian <bianpan2016@163.com>
Subject: Re: [PATCH 1/1] PCI: check return value of pci_find_ext_capability
Date: Mon, 24 Apr 2017 13:36:58 +0300 [thread overview]
Message-ID: <20170424103658.GU7152@lahna.fi.intel.com> (raw)
In-Reply-To: <1492956020-32271-1-git-send-email-bianpan201603@163.com>
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.
next prev parent reply other threads:[~2017-04-24 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-23 14:00 [PATCH 1/1] PCI: check return value of pci_find_ext_capability Pan Bian
2017-04-24 10:36 ` Mika Westerberg [this message]
2017-04-25 19:31 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170424103658.GU7152@lahna.fi.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=bianpan201603@163.com \
--cc=bianpan2016@163.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=rafael.j.wysocki@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).