Skip to content

Commit

Permalink
test/crypto: fix mbuf reset after null check
Browse files Browse the repository at this point in the history
[ upstream commit 2b81eb2 ]

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

Fixes: 202d375 ("app/test: add cryptodev unit and performance tests")

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
herbelot authored and cpaelzer committed Aug 9, 2021
1 parent c83dbe2 commit 9ab830c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/test/test_cryptodev.c
Expand Up @@ -112,10 +112,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;
Expand Down

0 comments on commit 9ab830c

Please sign in to comment.