Skip to contentSkip to conversation

examples/ethtool: fix unchecked return value

PATCH Applied Gargi Sau 3 participants 3 messages Dec 9, 2019 – Feb 13, 2020

lore
Share & tools
lore

Gargi Sau

author
#0 lore raw

PATCH 1/1 examples/ethtool: fix unchecked return value

This checks the return value from the function
rte_eth_dev_set_vlan_offload.

Coverity issue: 350358

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/lib/rte_ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/ethtool/lib/rte_ethtool.c +3 -1
index 667d7eaf2..db8150efd 100644
@@ -402,7 +402,9 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id)
 	}
 
 	/* Enable Rx vlan filter, VF unspport status is discard */
-	rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+	ret = rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+	if (ret != 0)
+		return ret;
 
 	return 0;
 }
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Gargi Sau

This checks the return value from the function
rte_eth_dev_set_vlan_offload.

Coverity issue: 350358

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/lib/rte_ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/ethtool/lib/rte_ethtool.c +0 -0
index 667d7eaf2..db8150efd 100644

examples/ethtool/lib/rte_ethtool.c rte_ethtool_net_set_rx_mode(uint16_t port_id) · line 408

Quoted 8 lines
examples/ethtool/lib/rte_ethtool.c +3 -1
@@ -402,7 +402,9 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id)
 	}
 
 	/* Enable Rx vlan filter, VF unspport status is discard */
-	rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+	ret = rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+	if (ret != 0)
+		return ret;
 

Looks ok to me.

#2 lore raw
Quoted 29 lines · Bruce Richardson
Quoted 17 lines · Gargi Sau

This checks the return value from the function
rte_eth_dev_set_vlan_offload.

Coverity issue: 350358

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/lib/rte_ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
examples/ethtool/lib/rte_ethtool.c +0 -0
index 667d7eaf2..db8150efd 100644

examples/ethtool/lib/rte_ethtool.c rte_ethtool_net_set_rx_mode(uint16_t port_id) · line 408

Quoted 8 lines
examples/ethtool/lib/rte_ethtool.c +3 -1
@@ -402,7 +402,9 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id)
      }
 
      /* Enable Rx vlan filter, VF unspport status is discard */
-     rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+     ret = rte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);
+     if (ret != 0)
+             return ret;
 

Looks ok to me.

Quoted 1 line

Applied, thanks.

Signature · 1 line
David Marchand