From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 34F4D1B108 for ; Wed, 21 Nov 2018 17:06:56 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89A81309EFFC; Wed, 21 Nov 2018 16:06:55 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3050A60A9C; Wed, 21 Nov 2018 16:06:54 +0000 (UTC) From: Kevin Traynor To: Anoob Joseph Cc: Akash Saxena , Akhil Goyal , dpdk stable Date: Wed, 21 Nov 2018 16:04:35 +0000 Message-Id: <20181121160440.9014-45-ktraynor@redhat.com> In-Reply-To: <20181121160440.9014-1-ktraynor@redhat.com> References: <20181121160440.9014-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 21 Nov 2018 16:06:55 +0000 (UTC) Subject: [dpdk-stable] patch 'app/test-crypto-perf: fix double allocation of memory' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Nov 2018 16:06:56 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/26/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From 8c5e8490acf258ad010d6c498f9cedc810b9fd6d Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Mon, 10 Sep 2018 12:10:58 +0530 Subject: [PATCH] app/test-crypto-perf: fix double allocation of memory [ upstream commit c61518ed86a02118322c9250be1797a58e3974ba ] The field, 'cipher_iv.data' is allocated twice when cipher is not null. Ideally the allocation should depend only on the field 'cperf_options.cipher_iv_sz'. This will make sure this code path gets valid for ciphers which doesn't require IV. Fixes: 0fbd75a99fc9 ("cryptodev: move IV parameters to session") Signed-off-by: Akash Saxena Signed-off-by: Anoob Joseph Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_test_vectors.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c index 907a995cc..1af952499 100644 --- a/app/test-crypto-perf/cperf_test_vectors.c +++ b/app/test-crypto-perf/cperf_test_vectors.c @@ -420,11 +420,17 @@ cperf_test_vector_get_dummy(struct cperf_options *options) t_vec->ciphertext.data = plaintext; t_vec->cipher_key.data = NULL; - t_vec->cipher_iv.data = NULL; } else { t_vec->cipher_key.length = options->cipher_key_sz; t_vec->ciphertext.data = ciphertext; t_vec->cipher_key.data = cipher_key; - t_vec->cipher_iv.data = rte_malloc(NULL, options->cipher_iv_sz, - 16); + } + + /* Init IV data ptr */ + t_vec->cipher_iv.data = NULL; + + if (options->cipher_iv_sz != 0) { + /* Set IV parameters */ + t_vec->cipher_iv.data = rte_malloc(NULL, + options->cipher_iv_sz, 16); if (t_vec->cipher_iv.data == NULL) { rte_free(t_vec); @@ -434,15 +440,5 @@ cperf_test_vector_get_dummy(struct cperf_options *options) } t_vec->ciphertext.length = options->max_buffer_size; - - /* Set IV parameters */ - t_vec->cipher_iv.data = rte_malloc(NULL, options->cipher_iv_sz, - 16); - if (options->cipher_iv_sz && t_vec->cipher_iv.data == NULL) { - rte_free(t_vec); - return NULL; - } - memcpy(t_vec->cipher_iv.data, iv, options->cipher_iv_sz); t_vec->cipher_iv.length = options->cipher_iv_sz; - t_vec->data.cipher_offset = 0; t_vec->data.cipher_length = options->max_buffer_size; -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-21 15:59:14.751640030 +0000 +++ 0045-app-test-crypto-perf-fix-double-allocation-of-memory.patch 2018-11-21 15:59:13.000000000 +0000 @@ -1,15 +1,16 @@ -From c61518ed86a02118322c9250be1797a58e3974ba Mon Sep 17 00:00:00 2001 +From 8c5e8490acf258ad010d6c498f9cedc810b9fd6d Mon Sep 17 00:00:00 2001 From: Anoob Joseph Date: Mon, 10 Sep 2018 12:10:58 +0530 Subject: [PATCH] app/test-crypto-perf: fix double allocation of memory +[ upstream commit c61518ed86a02118322c9250be1797a58e3974ba ] + The field, 'cipher_iv.data' is allocated twice when cipher is not null. Ideally the allocation should depend only on the field 'cperf_options.cipher_iv_sz'. This will make sure this code path gets valid for ciphers which doesn't require IV. Fixes: 0fbd75a99fc9 ("cryptodev: move IV parameters to session") -Cc: stable@dpdk.org Signed-off-by: Akash Saxena Signed-off-by: Anoob Joseph