Skip to contentSkip to conversation

test/test_cryptodev: do not use a possibly NULL Pointer

PATCH Applied Thierry Herbelot 2 participants 2 messages May 24, 2021 – Jun 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/test_cryptodev: do not use a possibly NULL Pointer

Use m only after it was checked not to be NULL.

Fixes 202d375c60bc1 ("app/test: add cryptodev unit and performance tests")
Cc Declan Doherty <[email protected]>
---
 app/test/test_cryptodev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
app/test/test_cryptodev.c +3 -2
index 39db52b17a2e..3c9770f6ea81 100644
@@ -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;
Signature · 1 line
2.29.2
Applied
#1 lore raw
Quoted 7 lines

Use m only after it was checked not to be NULL.

Fixes 202d375c60bc1 ("app/test: add cryptodev unit and performance

tests")
Cc: [email protected]
Cc: Declan Doherty <[email protected]>

Applied to dpdk-next-crypto

Thanks.