[dpdk-dev] [PATCH] examples/ethtool: fix bug in drvinfo callback

Qiming Yang qiming.yang at intel.com
Fri Nov 18 10:40:13 CET 2016


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")

Signed-off-by: Qiming Yang <qiming.yang at intel.com>
---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 9b77385..192d941 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -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;
-- 
2.7.4



More information about the dev mailing list