From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92611A0093 for ; Thu, 21 Apr 2022 19:35:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AB5D410FF; Thu, 21 Apr 2022 19:35:39 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id CF10E40040; Thu, 21 Apr 2022 19:35:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650562537; x=1682098537; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ecZqBTQ+2iExeU6C5sdMFHhjKaOWRhdM7GSAyvVlMl4=; b=jTLCf+kZHItSaT7Whpb+0d4CjskJzhxRY8l+c7zF93oZANAWy2yytdQg 5+19KOiaTLHEjgG/4hJrpDeRlcwO0lZfYA3OavPyQAfaSy2wB1hWRBMOh tar9IYt4FiaATm1wSiLvJqZRjtqmkohjWklCR9UcurSdL8u0Arev9tLP1 ywCLc73/Jzeps4VzmBztHFPwdSJ2fcT1O6tCNijjOPEHub5Ph7NyGgBih f9N5wTSRbQqyxOsYBfdgJiY1VWQizLv1crVh8WQS7ZY58tpet1eZnkhRW M7WDTp/ex5LUT2lMDAMBtOgMUxIqtQ5dIPRo/OUsuoHomYWrZ1bv8pkEJ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="244353353" X-IronPort-AV: E=Sophos;i="5.90,279,1643702400"; d="scan'208";a="244353353" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 10:35:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,279,1643702400"; d="scan'208";a="577368883" Received: from silpixa00400072.ir.intel.com (HELO silpixa00400072.ger.corp.intel.com) ([10.237.222.91]) by orsmga008.jf.intel.com with ESMTP; 21 Apr 2022 10:35:34 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, stable@dpdk.org Subject: [PATCH] app/test: fix buffer overflow in table unit tests Date: Thu, 21 Apr 2022 17:35:27 +0000 Message-Id: <20220421173528.2152008-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org This patch fixes stack buffer overflow reported by ASAN. Bugzilla ID: 820 Fixes: 5205954791cb ("app/test: packet framework unit tests") Cc: cristian.dumitrescu@intel.com Cc: stable@dpdk.org Signed-off-by: Vladimir Medvedkin --- app/test/test_table_tables.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index d5c5a426bc..010dd5a794 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -292,10 +292,10 @@ test_table_lpm(void) struct rte_mbuf *mbufs[RTE_PORT_IN_BURST_SIZE_MAX]; void *table; char *entries[RTE_PORT_IN_BURST_SIZE_MAX]; - char entry; + uint64_t entry; void *entry_ptr; int key_found; - uint32_t entry_size = 1; + uint32_t entry_size = sizeof(entry); /* Initialize params and create tables */ struct rte_table_lpm_params lpm_params = { @@ -357,7 +357,7 @@ test_table_lpm(void) struct rte_table_lpm_key lpm_key; lpm_key.ip = 0xadadadad; - table = rte_table_lpm_ops.f_create(&lpm_params, 0, 1); + table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); if (table == NULL) return -9; @@ -458,10 +458,10 @@ test_table_lpm_ipv6(void) struct rte_mbuf *mbufs[RTE_PORT_IN_BURST_SIZE_MAX]; void *table; char *entries[RTE_PORT_IN_BURST_SIZE_MAX]; - char entry; + uint64_t entry; void *entry_ptr; int key_found; - uint32_t entry_size = 1; + uint32_t entry_size = sizeof(entry); /* Initialize params and create tables */ struct rte_table_lpm_ipv6_params lpm_params = { -- 2.25.1