From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E24E5A0547; Mon, 24 May 2021 11:01:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D108E4110B; Mon, 24 May 2021 11:01:20 +0200 (CEST) Received: from proxy.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id C4D4A4003C; Mon, 24 May 2021 11:01:19 +0200 (CEST) Received: from localhost (unknown [10.16.0.39]) by proxy.6wind.com (Postfix) with ESMTP id B52F39B47AA; Mon, 24 May 2021 11:01:19 +0200 (CEST) From: Thierry Herbelot To: dev@dpdk.org Cc: Thierry Herbelot , Thomas Monjalon , stable@dpdk.org, Declan Doherty Date: Mon, 24 May 2021 11:01:13 +0200 Message-Id: <20210524090113.16748-1-thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] test/test_cryptodev: do not use a possibly NULL Pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" 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 Signed-off-by: Thierry Herbelot --- app/test/test_cryptodev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; -- 2.29.2