DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chenbo Xia <chenbo.xia@intel.com>
To: dev@dpdk.org
Cc: jianjay.zhou@huawei.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v1] crypto/virtio: fix return value check
Date: Fri, 19 Apr 2019 00:58:34 +0000	[thread overview]
Message-ID: <20190419005834.34023-1-chenbo.xia@intel.com> (raw)

Fix unchecked return value issue for rte_pci_read_config.

Coverity issue: 302861
Fixes: 25500d4b8076 ("crypto/virtio: support device init")
Cc: stable@dpdk.org

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 drivers/crypto/virtio/virtio_pci.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c
index 0c0c64471..8137b3c5a 100644
--- a/drivers/crypto/virtio/virtio_pci.c
+++ b/drivers/crypto/virtio/virtio_pci.c
@@ -397,9 +397,13 @@ virtio_read_caps(struct rte_pci_device *dev, struct virtio_crypto_hw *hw)
 			hw->common_cfg = get_cfg_addr(dev, &cap);
 			break;
 		case VIRTIO_PCI_CAP_NOTIFY_CFG:
-			rte_pci_read_config(dev, &hw->notify_off_multiplier,
+			ret = rte_pci_read_config(dev, &hw->notify_off_multiplier,
 					4, pos + sizeof(cap));
-			hw->notify_base = get_cfg_addr(dev, &cap);
+			if (ret != 4)
+				VIRTIO_CRYPTO_INIT_LOG_ERR(
+					"failed to read notify_off_multiplier: ret %d", ret);
+			else
+				hw->notify_base = get_cfg_addr(dev, &cap);
 			break;
 		case VIRTIO_PCI_CAP_DEVICE_CFG:
 			hw->dev_cfg = get_cfg_addr(dev, &cap);
-- 
2.17.1

             reply	other threads:[~2019-04-19  1:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  0:58 Chenbo Xia [this message]
2019-04-19  0:58 ` Chenbo Xia
2019-06-19 15:03 Akhil Goyal

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=20190419005834.34023-1-chenbo.xia@intel.com \
    --to=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianjay.zhou@huawei.com \
    --cc=stable@dpdk.org \
    /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).