From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 32D97DE0 for ; Wed, 8 Feb 2017 15:09:08 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 08 Feb 2017 06:09:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="1104663642" Received: from gklab-246-019.igk.intel.com (HELO intel.com) ([10.217.246.19]) by fmsmga001.fm.intel.com with SMTP; 08 Feb 2017 06:09:03 -0800 Received: by intel.com (sSMTP sendmail emulation); Wed, 08 Feb 2017 17:04:45 +0100 From: Jacek Piasecki To: declan.doherty@intel.com Cc: dev@dpdk.org, Jacek Piasecki Date: Wed, 8 Feb 2017 17:04:40 +0100 Message-Id: <1486569881-16220-1-git-send-email-jacekx.piasecki@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: fix big paremeter passed by value 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: , X-List-Received-Date: Wed, 08 Feb 2017 14:09:09 -0000 Structure opts and structure test_vec are now passed by pointer to the cperf_check_test_vector. Coverity issue: 141072 Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Signed-off-by: Jacek Piasecki --- app/test-crypto-perf/main.c | 98 ++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 6c128d8..634ea5f 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -162,94 +162,94 @@ } static int -cperf_check_test_vector(struct cperf_options opts, - struct cperf_test_vector test_vec) +cperf_check_test_vector(struct cperf_options *opts, + struct cperf_test_vector *test_vec) { - if (opts.op_type == CPERF_CIPHER_ONLY) { - if (opts.cipher_algo == RTE_CRYPTO_CIPHER_NULL) { - if (test_vec.plaintext.data == NULL) + if (opts->op_type == CPERF_CIPHER_ONLY) { + if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) { + if (test_vec->plaintext.data == NULL) return -1; - } else if (opts.cipher_algo != RTE_CRYPTO_CIPHER_NULL) { - if (test_vec.plaintext.data == NULL) + } else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { + if (test_vec->plaintext.data == NULL) return -1; - if (test_vec.plaintext.length != opts.buffer_sz) + if (test_vec->plaintext.length != opts->buffer_sz) return -1; - if (test_vec.ciphertext.data == NULL) + if (test_vec->ciphertext.data == NULL) return -1; - if (test_vec.ciphertext.length != opts.buffer_sz) + if (test_vec->ciphertext.length != opts->buffer_sz) return -1; - if (test_vec.iv.data == NULL) + if (test_vec->iv.data == NULL) return -1; - if (test_vec.iv.length != opts.cipher_iv_sz) + if (test_vec->iv.length != opts->cipher_iv_sz) return -1; - if (test_vec.cipher_key.data == NULL) + if (test_vec->cipher_key.data == NULL) return -1; - if (test_vec.cipher_key.length != opts.cipher_key_sz) + if (test_vec->cipher_key.length != opts->cipher_key_sz) return -1; } - } else if (opts.op_type == CPERF_AUTH_ONLY) { - if (opts.auth_algo != RTE_CRYPTO_AUTH_NULL) { - if (test_vec.plaintext.data == NULL) + } else if (opts->op_type == CPERF_AUTH_ONLY) { + if (opts->auth_algo != RTE_CRYPTO_AUTH_NULL) { + if (test_vec->plaintext.data == NULL) return -1; - if (test_vec.plaintext.length != opts.buffer_sz) + if (test_vec->plaintext.length != opts->buffer_sz) return -1; - if (test_vec.auth_key.data == NULL) + if (test_vec->auth_key.data == NULL) return -1; - if (test_vec.auth_key.length != opts.auth_key_sz) + if (test_vec->auth_key.length != opts->auth_key_sz) return -1; - if (test_vec.digest.data == NULL) + if (test_vec->digest.data == NULL) return -1; - if (test_vec.digest.length != opts.auth_digest_sz) + if (test_vec->digest.length != opts->auth_digest_sz) return -1; } - } else if (opts.op_type == CPERF_CIPHER_THEN_AUTH || - opts.op_type == CPERF_AUTH_THEN_CIPHER) { - if (opts.cipher_algo == RTE_CRYPTO_CIPHER_NULL) { - if (test_vec.plaintext.data == NULL) + } else if (opts->op_type == CPERF_CIPHER_THEN_AUTH || + opts->op_type == CPERF_AUTH_THEN_CIPHER) { + if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) { + if (test_vec->plaintext.data == NULL) return -1; - if (test_vec.plaintext.length != opts.buffer_sz) + if (test_vec->plaintext.length != opts->buffer_sz) return -1; - } else if (opts.cipher_algo != RTE_CRYPTO_CIPHER_NULL) { - if (test_vec.plaintext.data == NULL) + } else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) { + if (test_vec->plaintext.data == NULL) return -1; - if (test_vec.plaintext.length != opts.buffer_sz) + if (test_vec->plaintext.length != opts->buffer_sz) return -1; - if (test_vec.ciphertext.data == NULL) + if (test_vec->ciphertext.data == NULL) return -1; - if (test_vec.ciphertext.length != opts.buffer_sz) + if (test_vec->ciphertext.length != opts->buffer_sz) return -1; - if (test_vec.iv.data == NULL) + if (test_vec->iv.data == NULL) return -1; - if (test_vec.iv.length != opts.cipher_iv_sz) + if (test_vec->iv.length != opts->cipher_iv_sz) return -1; - if (test_vec.cipher_key.data == NULL) + if (test_vec->cipher_key.data == NULL) return -1; - if (test_vec.cipher_key.length != opts.cipher_key_sz) + if (test_vec->cipher_key.length != opts->cipher_key_sz) return -1; } - if (opts.auth_algo != RTE_CRYPTO_AUTH_NULL) { - if (test_vec.auth_key.data == NULL) + if (opts->auth_algo != RTE_CRYPTO_AUTH_NULL) { + if (test_vec->auth_key.data == NULL) return -1; - if (test_vec.auth_key.length != opts.auth_key_sz) + if (test_vec->auth_key.length != opts->auth_key_sz) return -1; - if (test_vec.digest.data == NULL) + if (test_vec->digest.data == NULL) return -1; - if (test_vec.digest.length != opts.auth_digest_sz) + if (test_vec->digest.length != opts->auth_digest_sz) return -1; } - } else if (opts.op_type == CPERF_AEAD) { - if (test_vec.plaintext.data == NULL) + } else if (opts->op_type == CPERF_AEAD) { + if (test_vec->plaintext.data == NULL) return -1; - if (test_vec.plaintext.length != opts.buffer_sz) + if (test_vec->plaintext.length != opts->buffer_sz) return -1; - if (test_vec.aad.data == NULL) + if (test_vec->aad.data == NULL) return -1; - if (test_vec.aad.length != opts.auth_aad_sz) + if (test_vec->aad.length != opts->auth_aad_sz) return -1; - if (test_vec.digest.data == NULL) + if (test_vec->digest.data == NULL) return -1; - if (test_vec.digest.length != opts.auth_digest_sz) + if (test_vec->digest.length != opts->auth_digest_sz) return -1; } return 0; @@ -320,7 +320,7 @@ goto err; } - if (cperf_check_test_vector(opts, *t_vec)) { + if (cperf_check_test_vector(&opts, t_vec)) { RTE_LOG(ERR, USER1, "Incomplete necessary test vectors" "\n"); goto err; -- 1.9.1 -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.