DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, akhil.goyal@nxp.com
Cc: Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH] test/compress: fix coverity warnings
Date: Tue, 23 Jul 2019 12:53:49 +0200	[thread overview]
Message-ID: <20190723105349.23622-1-adamx.dybkowski@intel.com> (raw)

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 <adamx.dybkowski@intel.com>
---
 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


             reply	other threads:[~2019-07-23 11:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 10:53 Adam Dybkowski [this message]
2019-07-25 13:56 ` Trahe, Fiona
2019-07-25 14:22   ` Dybkowski, AdamX
2019-07-26  8:37     ` Trahe, Fiona
2019-07-26 12:43       ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723105349.23622-1-adamx.dybkowski@intel.com \
    --to=adamx.dybkowski@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).