From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B1D75A046B for ; Tue, 23 Jul 2019 13:02:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EDE641BFF5; Tue, 23 Jul 2019 13:01:57 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B2A8D1BFE0 for ; Tue, 23 Jul 2019 13:01:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2019 04:01:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,298,1559545200"; d="scan'208";a="188818846" Received: from adamdybx-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.104.14.181]) by fmsmga001.fm.intel.com with ESMTP; 23 Jul 2019 04:01:54 -0700 From: Adam Dybkowski To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com Cc: Adam Dybkowski Date: Tue, 23 Jul 2019 12:53:49 +0200 Message-Id: <20190723105349.23622-1-adamx.dybkowski@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] test/compress: fix coverity warnings 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" CID 340857: Null pointer dereferences (NULL_RETURNS) CID 340856: (CONSTANT_EXPRESSION_RESULT) Fixes: 3be12ea52ad8 ("test/compress: improve debug trace setup") Signed-off-by: Adam Dybkowski --- app/test/test_compressdev.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c index 65889c242..992eac8e0 100644 --- a/app/test/test_compressdev.c +++ b/app/test/test_compressdev.c @@ -755,6 +755,12 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data, char *contig_buf = NULL; uint64_t compress_checksum[num_bufs]; + if (capa == NULL) { + RTE_LOG(ERR, USER1, + "Compress device does not support DEFLATE\n"); + return -1; + } + /* Initialize all arrays to NULL */ memset(uncomp_bufs, 0, sizeof(struct rte_mbuf *) * num_bufs); memset(comp_bufs, 0, sizeof(struct rte_mbuf *) * num_bufs); @@ -975,7 +981,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data, enum rte_comp_huffman huffman_type = compress_xform->deflate.huffman; char engine[] = "zlib (directly, not PMD)"; - if (zlib_dir != ZLIB_COMPRESS || zlib_dir != ZLIB_ALL) + if (zlib_dir != ZLIB_COMPRESS && zlib_dir != ZLIB_ALL) strlcpy(engine, "PMD", sizeof(engine)); RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to" @@ -1211,7 +1217,7 @@ test_deflate_comp_decomp(const struct interim_data_params *int_data, for (i = 0; i < num_bufs; i++) { priv_data = (struct priv_op_data *)(ops_processed[i] + 1); char engine[] = "zlib, (directly, no PMD)"; - if (zlib_dir != ZLIB_DECOMPRESS || zlib_dir != ZLIB_ALL) + if (zlib_dir != ZLIB_DECOMPRESS && zlib_dir != ZLIB_ALL) strlcpy(engine, "pmd", sizeof(engine)); RTE_LOG(DEBUG, USER1, "Buffer %u decompressed by %s from %u to %u bytes\n", -- 2.17.1