[v2] app/testpmd: fix DCB set failure

Message ID 20200512101356.23729-1-ting.xu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] app/testpmd: fix DCB set failure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing fail Testing issues

Commit Message

Xu, Ting May 12, 2020, 10:13 a.m. UTC
  When set DCB in testpmd, there is a segmentation fault. It is
because the local variable rss_conf in get_eth_dcb_conf()
is not cleared, so that the pointer member variable rss_key has
a random address, which leads to an error in the following
processing. This patch initialized the local variable rss_conf
to avoid this situation.

Fixes: ac7c491c3fec ("app/testpmd: fix DCB config")
Cc: stable@dpdk.org

Signed-off-by: Ting Xu <ting.xu@intel.com>

---
v1->v2: modify commit log, move memset to else leg
---
 app/test-pmd/testpmd.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Ferruh Yigit May 18, 2020, 5:06 p.m. UTC | #1
On 5/12/2020 11:13 AM, Ting Xu wrote:
> When set DCB in testpmd, there is a segmentation fault. It is
> because the local variable rss_conf in get_eth_dcb_conf()
> is not cleared, so that the pointer member variable rss_key has
> a random address, which leads to an error in the following
> processing. This patch initialized the local variable rss_conf
> to avoid this situation.
> 
> Fixes: ac7c491c3fec ("app/testpmd: fix DCB config")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ting Xu <ting.xu@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a2d0be56b..9ad34421c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3448,6 +3448,8 @@  get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf,
 		struct rte_eth_dcb_tx_conf *tx_conf =
 				&eth_conf->tx_adv_conf.dcb_tx_conf;
 
+		memset(&rss_conf, 0, sizeof(struct rte_eth_rss_conf));
+
 		rc = rte_eth_dev_rss_hash_conf_get(pid, &rss_conf);
 		if (rc != 0)
 			return rc;