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 3DB0A2B86 for ; Wed, 15 May 2019 17:45:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2019 08:45:41 -0700 X-ExtLoop1: 1 Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.136]) by FMSMGA003.fm.intel.com with ESMTP; 15 May 2019 08:45:40 -0700 From: Fan Zhang To: dev@dpdk.org Cc: akhil.goyal@nxp.com, Fan Zhang Date: Wed, 15 May 2019 16:41:21 +0100 Message-Id: <20190515154121.75459-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.14.5 Subject: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code 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, 15 May 2019 15:45:42 -0000 Coverity issue: 336866 Coverity issue: 336841 Coverity issue: 336838 Fixes: 41d561cbdd24 ("examples/fips_validation: add power on self test") Signed-off-by: Fan Zhang --- examples/fips_validation/fips_dev_self_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index df1c0e82e..444bbaa79 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -1333,6 +1333,9 @@ check_cipher_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (dir == self_test_dir_enc_auth_gen) { src = vec->output.data; src_len = vec->output.len; @@ -1342,7 +1345,7 @@ check_cipher_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); @@ -1362,8 +1365,11 @@ check_auth_result(struct rte_crypto_op *op, uint32_t len; int ret; + if (mbuf == NULL) + return -1; + GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; if (dir == self_test_dir_enc_auth_gen) { @@ -1387,6 +1393,9 @@ check_aead_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (op->sym->aead.aad.data) rte_free(op->sym->aead.aad.data); @@ -1399,7 +1408,7 @@ check_aead_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); -- 2.14.5 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6065FA00E6 for ; Wed, 15 May 2019 17:45:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 53B1B5A44; Wed, 15 May 2019 17:45:43 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 3DB0A2B86 for ; Wed, 15 May 2019 17:45:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2019 08:45:41 -0700 X-ExtLoop1: 1 Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.136]) by FMSMGA003.fm.intel.com with ESMTP; 15 May 2019 08:45:40 -0700 From: Fan Zhang To: dev@dpdk.org Cc: akhil.goyal@nxp.com, Fan Zhang Date: Wed, 15 May 2019 16:41:21 +0100 Message-Id: <20190515154121.75459-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.14.5 Subject: [dpdk-dev] [PATCH] examples/fips_validation: fix logically dead code 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190515154121.CRBjdc52TUbvLVBDjQlk58oH0ztH6jTWiaBMLbVwRQs@z> Coverity issue: 336866 Coverity issue: 336841 Coverity issue: 336838 Fixes: 41d561cbdd24 ("examples/fips_validation: add power on self test") Signed-off-by: Fan Zhang --- examples/fips_validation/fips_dev_self_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/fips_validation/fips_dev_self_test.c b/examples/fips_validation/fips_dev_self_test.c index df1c0e82e..444bbaa79 100644 --- a/examples/fips_validation/fips_dev_self_test.c +++ b/examples/fips_validation/fips_dev_self_test.c @@ -1333,6 +1333,9 @@ check_cipher_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (dir == self_test_dir_enc_auth_gen) { src = vec->output.data; src_len = vec->output.len; @@ -1342,7 +1345,7 @@ check_cipher_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); @@ -1362,8 +1365,11 @@ check_auth_result(struct rte_crypto_op *op, uint32_t len; int ret; + if (mbuf == NULL) + return -1; + GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; if (dir == self_test_dir_enc_auth_gen) { @@ -1387,6 +1393,9 @@ check_aead_result(struct rte_crypto_op *op, uint32_t len, src_len; int ret; + if (!mbuf) + return -1; + if (op->sym->aead.aad.data) rte_free(op->sym->aead.aad.data); @@ -1399,7 +1408,7 @@ check_aead_result(struct rte_crypto_op *op, } GET_MBUF_DATA(data, len, mbuf); - if (!data && !len) + if (!len) return -1; ret = memcmp(data, src, src_len); -- 2.14.5