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 D8E96A034F; Wed, 13 May 2020 03:51:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B7E31C012; Wed, 13 May 2020 03:51:07 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7658A1BFE3; Wed, 13 May 2020 03:51:05 +0200 (CEST) IronPort-SDR: 5a2OPWopV+GglPQ6IKYFFTpG/6S+lsm8dbwTRMjmDubMR6mC2tWh7rN6bD/9DuOUZYrJ4LBaDZ FNYGx3VdWeOQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 18:51:04 -0700 IronPort-SDR: aqpSUFUlLzxONhFr6fahlTo+Fntl1VjWB+76M91Adg+nXU/SIUGj3fuv7U51QoKshWRorpu3j8 veQdN1tL1jnA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,385,1583222400"; d="scan'208";a="463756355" Received: from dpdk-xuting-main.sh.intel.com ([10.67.116.253]) by fmsmga005.fm.intel.com with ESMTP; 12 May 2020 18:51:02 -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 09:50:24 +0000 Message-Id: <20200513095024.46921-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 v3] 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 --- 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..6c86d7a73 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(struct rte_eth_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