From patchwork Thu Aug 12 14:24:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Power, Ciara" X-Patchwork-Id: 96870 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98236A0C4E; Thu, 12 Aug 2021 16:24:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D075D41124; Thu, 12 Aug 2021 16:24:44 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 549F2410F8; Thu, 12 Aug 2021 16:24:43 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10074"; a="279103352" X-IronPort-AV: E=Sophos;i="5.84,316,1620716400"; d="scan'208";a="279103352" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2021 07:24:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,316,1620716400"; d="scan'208";a="517474755" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.223.24]) by FMSMGA003.fm.intel.com with ESMTP; 12 Aug 2021 07:24:39 -0700 From: Ciara Power To: dev@dpdk.org Cc: stable@dpdk.org, roy.fan.zhang@intel.com, Ciara Power , damianx.nowak@intel.com, Marko Kovacevic Date: Thu, 12 Aug 2021 14:24:34 +0000 Message-Id: <20210812142436.108053-2-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812142436.108053-1-ciara.power@intel.com> References: <20210812142436.108053-1-ciara.power@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 1/2] examples/fips_validation: fix unused malloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The val.val pointer is allocated memory, however this memory is then freed in get_writeback_data() without being used beforehand. The pointer is then allocated memory again before use, so the very first allocation is removed as it was unnecessary. Fixes: f4797bae0050 ("examples/fips_validation: support plain SHA") Cc: damianx.nowak@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power Acked-by: Fan Zhang --- examples/fips_validation/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index c175fe6ac2..2db00620ce 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1635,7 +1635,6 @@ fips_mct_sha_test(void) int ret; uint32_t i, j; - val.val = rte_malloc(NULL, (MAX_DIGEST_SIZE*SHA_MD_BLOCK), 0); for (i = 0; i < SHA_MD_BLOCK; i++) md[i].val = rte_malloc(NULL, (MAX_DIGEST_SIZE*2), 0); From patchwork Thu Aug 12 14:24:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Power, Ciara" X-Patchwork-Id: 96871 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3E7AA0C4E; Thu, 12 Aug 2021 16:24:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3228E41218; Thu, 12 Aug 2021 16:24:49 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 31E99410F8; Thu, 12 Aug 2021 16:24:47 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10074"; a="279103356" X-IronPort-AV: E=Sophos;i="5.84,316,1620716400"; d="scan'208";a="279103356" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2021 07:24:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,316,1620716400"; d="scan'208";a="517474772" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.223.24]) by FMSMGA003.fm.intel.com with ESMTP; 12 Aug 2021 07:24:42 -0700 From: Ciara Power To: dev@dpdk.org Cc: stable@dpdk.org, roy.fan.zhang@intel.com, Ciara Power , Marko Kovacevic Date: Thu, 12 Aug 2021 14:24:35 +0000 Message-Id: <20210812142436.108053-3-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812142436.108053-1-ciara.power@intel.com> References: <20210812142436.108053-1-ciara.power@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 2/2] examples/fips_validation: fix resetting pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The env.digest memory was freed, but the pointer was not set to NULL afterwards. This caused an "Invalid Memory" error, as the pointer tries to free twice. Fixes: 952e10cdad5e ("examples/fips_validation: support scatter gather list") Cc: roy.fan.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power Acked-by: Fan Zhang --- examples/fips_validation/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c index 2db00620ce..5d14513a58 100644 --- a/examples/fips_validation/main.c +++ b/examples/fips_validation/main.c @@ -1846,8 +1846,10 @@ fips_test_one_file(void) fips_test_clear(); - if (env.digest) + if (env.digest) { rte_free(env.digest); + env.digest = NULL; + } if (env.mbuf) rte_pktmbuf_free(env.mbuf);