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

Message ID 1479778884-26993-1-git-send-email-qiming.yang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
checkpatch/checkpatch success coding style OK

Commit Message

Qiming Yang Nov. 22, 2016, 1:41 a.m. UTC
  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")

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
v2 changes:
* fixed the spelling mistake in commit log
---
---
 examples/ethtool/ethtool-app/ethapp.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Remy Horton Nov. 23, 2016, 1 a.m. UTC | #1
Not sure this is a problem in practice, as the same set if fields is 
updated each time...at least for now.

On 22/11/2016 09:41, Qiming Yang wrote:
> 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")
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>

Acked-by: Remy Horton <remy.horton@intel.com>
  
Thomas Monjalon Dec. 20, 2016, 5:21 p.m. UTC | #2
2016-11-23 09:00, Remy Horton:
> Not sure this is a problem in practice, as the same set if fields is 
> updated each time...at least for now.
> 
> On 22/11/2016 09:41, Qiming Yang wrote:
> > 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")
> >
> > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> 
> Acked-by: Remy Horton <remy.horton@intel.com>

Applied, thanks
  

Patch

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;