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 C15D4A0487 for ; Tue, 2 Jul 2019 13:22:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C463D2C23; Tue, 2 Jul 2019 13:22:29 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9D9882BC8; Tue, 2 Jul 2019 13:22:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2019 04:22:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,443,1557212400"; d="scan'208";a="186839958" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 02 Jul 2019 04:22:25 -0700 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x62BMOY8015595; Tue, 2 Jul 2019 12:22:24 +0100 Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x62BLulk025679; Tue, 2 Jul 2019 12:21:56 +0100 Received: (from jmparthx@localhost) by wgcvswdev001.ir.intel.com with œ id x62BLuNt025675; Tue, 2 Jul 2019 12:21:56 +0100 From: Jananee Parthasarathy To: dev@dpdk.org Cc: reshma.pattan@intel.com, david.marchand@redhat.com, cristian.dumitrescu@intel.com, jasvinder.singh@intel.com, Jananee Parthasarathy , stable@dpdk.org Date: Tue, 2 Jul 2019 12:21:34 +0100 Message-Id: <1562066494-25411-1-git-send-email-jananeex.m.parthasarathy@intel.com> X-Mailer: git-send-email 1.7.12.2 Subject: [dpdk-dev] [PATCH] lib/table: fix table autotest ut crashes in ipv6 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" Unit test table_autotest results in segmentation fault. Crash occurs in test_table_lpm_ipv6_combined(). Variable 'nht_pos0' used as array subscript is not initialized in rte_table_lpm_ipv6_entry_add(). It will not be assigned, if a rule does not exist. In such case a junk number or invalid array index might result in segmentation fault due to array out of bounds when lpm->nht_users is used with such invalid array index. Fix is to initialize the variables used for array subscript. Fixes: d89a5bce1d ("lpm6: extend next hop field") Cc: stable@dpdk.org Signed-off-by: Jananee Parthasarathy --- lib/librte_table/rte_table_lpm_ipv6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c index a55f808a4..4e068d79b 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.c +++ b/lib/librte_table/rte_table_lpm_ipv6.c @@ -182,7 +182,7 @@ rte_table_lpm_ipv6_entry_add( struct rte_table_lpm_ipv6 *lpm = table; struct rte_table_lpm_ipv6_key *ip_prefix = key; - uint32_t nht_pos, nht_pos0, nht_pos0_valid; + uint32_t nht_pos = 0, nht_pos0 = 0, nht_pos0_valid = 0; int status; /* Check input parameters */ -- 2.14.1