Skip to contentSkip to conversation

net/ice: fix unchecked return value

PATCH Superseded Wenjun Wu 1 participant 1 message Feb 26, 2021 Network drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wenjun Wu

author
#0 lore raw

PATCH 1/1 net/ice: fix unchecked return value

Fix unchecked return values reported by coverity.

Coverity issue: 349907

Fixes 03a05924dad0 ("net/ice: support device-specific DDP package loading")
---
 drivers/net/ice/ice_ethdev.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ice/ice_ethdev.c +8 -2
index dfd99ace9..dfb43b92d 100644
@@ -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");
+			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");
+			return -1;
+		}
 		snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE,
 			 "ice-%08x%08x.pkg", dsn_high, dsn_low);
 	} else {
Signature · 1 line
2.25.1