Skip to contentSkip to conversation

examples/ethtool: fix bug in drvinfo callback

PATCH Superseded Qiming Yang 3 participants 4 messages Nov 18, 2016 – Dec 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ethtool: fix bug in drvinfo callback

Function pcmd_drvinfo_callback uses struct info to get the ethtool infomation of each port. Struct info will store the infomation of previous port until this infomation be updated. This patch fixes this issue.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 1 file changed, 1 insertion(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 9b77385..192d941 100644
@@ -177,6 +177,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 	int id_port;
 
 	for (id_port = 0; id_port < rte_eth_dev_count(); id_port++) {
+		memset(&info, 0, sizeof(info));
 		if (rte_ethtool_get_drvinfo(id_port, &info)) {
 			printf("Error getting info for port %i\n", id_port);
 			return;
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 examples/ethtool: fix bug in drvinfo callback

Function pcmd_drvinfo_callback uses struct info to get the ethtool information of each port. Struct info will store the information of previous port until this information be updated. This patch fixes this issue.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")

---
v2 changes:
* fixed the spelling mistake in commit log
---

---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 1 file changed, 1 insertion(+)
examples/ethtool/ethtool-app/ethapp.c +1 -0
index 9b77385..192d941 100644
@@ -177,6 +177,7 @@ pcmd_drvinfo_callback(__rte_unused void *ptr_params,
 	int id_port;
 
 	for (id_port = 0; id_port < rte_eth_dev_count(); id_port++) {
+		memset(&info, 0, sizeof(info));
 		if (rte_ethtool_get_drvinfo(id_port, &info)) {
 			printf("Error getting info for port %i\n", id_port);
 			return;
Signature · 1 line
2.7.4
Acked-by on v2 1/1
#2 lore raw

Not sure this is a problem in practice, as the same set if fields is updated each time...at least for now.

Quoted 8 lines · Qiming Yang

Function pcmd_drvinfo_callback uses struct info to get the ethtool information of each port. Struct info will store the information of previous port until this information be updated. This patch fixes this issue.

Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
#3 lore raw

2016-11-23 09:00, Remy Horton:

Quoted 9 lines

Not sure this is a problem in practice, as the same set if fields is updated each time...at least for now.

Quoted 5 lines · Qiming Yang

Function pcmd_drvinfo_callback uses struct info to get the ethtool information of each port. Struct info will store the information of previous port until this information be updated. This patch fixes this issue.

Quoted 5 lines
Quoted 3 lines
Fixes bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")

Applied, thanks