From: Wenjun Wu <wenjun1.wu@intel.com>
To: dev@dpdk.org, qiming.yang@intel.com, qi.z.zhang@intel.com
Cc: Wenjun Wu <wenjun1.wu@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] net/ice: fix unchecked return value
Date: Fri, 26 Feb 2021 15:22:00 +0800 [thread overview]
Message-ID: <20210226072200.227939-1-wenjun1.wu@intel.com> (raw)
In-Reply-To: <20210226022542.214104-1>
Fix unchecked return values reported by coverity.
Coverity issue: 349907
Fixes: 03a05924dad0 ("net/ice: support device-specific DDP package loading")
Cc: stable@dpdk.org
Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
v2: modify err message; fix the issue related to that reported by coverity
---
drivers/net/ice/ice_ethdev.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index dfd99ace9..f43b2e0b2 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1663,8 +1663,14 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)
pos = rte_pci_find_ext_capability(pci_dev, RTE_PCI_EXT_CAP_ID_DSN);
if (pos) {
- rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4);
- rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8);
+ if (rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4) < 0) {
+ PMD_INIT_LOG(ERR, "Failed to read pci config space\n");
+ return -1;
+ }
+ if (rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8) < 0) {
+ PMD_INIT_LOG(ERR, "Failed to read pci config space\n");
+ return -1;
+ }
snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,
"ice-%08x%08x.pkg", dsn_high, dsn_low);
} else {
@@ -1727,7 +1733,11 @@ static int ice_load_pkg(struct rte_eth_dev *dev)
struct ice_adapter *ad =
ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- ice_pkg_file_search_path(pci_dev, pkg_file);
+ err = ice_pkg_file_search_path(pci_dev, pkg_file);
+ if (err) {
+ PMD_INIT_LOG(ERR, "failed to search file path\n");
+ return err;
+ }
file = fopen(pkg_file, "rb");
if (!file) {
--
2.25.1
next parent reply other threads:[~2021-02-26 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210226022542.214104-1>
2021-02-26 7:22 ` Wenjun Wu [this message]
2021-03-22 13:19 ` [dpdk-dev] [PATCH v2] net/ice: fix unchecked return value Zhang, Qi Z
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=20210226072200.227939-1-wenjun1.wu@intel.com \
--to=wenjun1.wu@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.