diff mbox series

test/test_cryptodev: do not use a possibly NULL Pointer

Message ID 20210524090113.16748-1-thierry.herbelot@6wind.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers show
Series test/test_cryptodev: do not use a possibly NULL Pointer | expand

Checks

Context Check Description
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional fail Functional Testing issues
ci/iol-testing fail Testing issues
ci/intel-Testing success Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-abi-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Thierry Herbelot May 24, 2021, 9:01 a.m. UTC
Use m only after it was checked not to be NULL.

Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests")
Cc: stable@dpdk.org
Cc: Declan Doherty <declan.doherty@intel.com>

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 app/test/test_cryptodev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Akhil Goyal June 29, 2021, 8:34 p.m. UTC | #1
> Use m only after it was checked not to be NULL.
> 
> Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance
> tests")
> Cc: stable@dpdk.org
> Cc: Declan Doherty <declan.doherty@intel.com>
> 
Applied to dpdk-next-crypto

Thanks.
diff mbox series

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 39db52b17a2e..3c9770f6ea81 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -135,10 +135,11 @@  setup_test_string(struct rte_mempool *mpool,
 	struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
 	size_t t_len = len - (blocksize ? (len % blocksize) : 0);
 
-	memset(m->buf_addr, 0, m->buf_len);
 	if (m) {
-		char *dst = rte_pktmbuf_append(m, t_len);
+		char *dst;
 
+		memset(m->buf_addr, 0, m->buf_len);
+		dst = rte_pktmbuf_append(m, t_len);
 		if (!dst) {
 			rte_pktmbuf_free(m);
 			return NULL;