From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9CCC2A034F; Wed, 13 May 2020 04:08:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 355181BFE6; Wed, 13 May 2020 04:08:31 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E96671BFE3; Wed, 13 May 2020 04:08:28 +0200 (CEST) IronPort-SDR: SdN8FuaSTwRj2FtM+WW783cm8IKxjqCxfdeMFpMmb08G/1ZasLny0gPeC0u7WFZ5tgOk+XKCQK kEAaoymv+9Mw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 19:08:28 -0700 IronPort-SDR: i5bDq5l0OujZep9diEEhtcIWdM3wd6UMl7n8BXCdL1i2w6zlvwWZ+sf5mTC9kahHmi+UuT88WQ khYMzllBQrwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,385,1583222400"; d="scan'208";a="437317914" Received: from dpdk-xuting-main.sh.intel.com ([10.67.116.253]) by orsmga005.jf.intel.com with ESMTP; 12 May 2020 19:08:26 -0700 From: Ting Xu To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, stable@dpdk.org Date: Wed, 13 May 2020 10:07:45 +0000 Message-Id: <20200513100745.13118-1-ting.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511102504.23936-1-ting.xu@intel.com> References: <20200511102504.23936-1-ting.xu@intel.com> Subject: [dpdk-dev] [PATCH v4] app/testpmd: fix DCB set failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- V3->v4: fix build failure v2->v3: move memset to rte_eth_dev_rss_hash_conf_get from testpmd v1->v2: modify commit log, move memset to else leg --- lib/librte_ethdev/rte_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8e10a6fc3..1f6ca742a 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -3549,6 +3549,8 @@ rte_eth_dev_rss_hash_conf_get(uint16_t port_id, { struct rte_eth_dev *dev; + memset(rss_conf, 0, sizeof(*rss_conf)); + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP); -- 2.17.1