From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 38F5A5954 for ; Mon, 23 May 2016 17:46:57 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 23 May 2016 08:46:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,356,1459839600"; d="scan'208";a="986952493" Received: from sie-lab-214-241.ir.intel.com (HELO silpixa00382162.ir.intel.com) ([10.237.214.241]) by fmsmga002.fm.intel.com with ESMTP; 23 May 2016 08:46:55 -0700 From: Deepak Kumar Jain To: declan.doherty@intel.com Cc: deepak.k.jain@intel.com, dev@dpdk.org Date: Mon, 23 May 2016 16:46:53 +0100 Message-Id: <1464018413-71800-1-git-send-email-deepak.k.jain@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] crypto: fix null pointer dereferencing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2016 15:46:57 -0000 From: "Jain, Deepak K" Fix null pointer dereferencing by reporing if null and exiting the function. Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented") Coverity issue: 126584 Signed-off-by: Deepak Kumar Jain --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 9c42f88..31784e1 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -379,9 +379,11 @@ process_crypto_op(struct aesni_mb_qp *qp, struct rte_crypto_op *op, /* append space for output data to mbuf */ char *odata = rte_pktmbuf_append(m_dst, rte_pktmbuf_data_len(op->sym->m_src)); - if (odata == NULL) + if (odata == NULL) { MB_LOG_ERR("failed to allocate space in destination " "mbuf for source data"); + return NULL; + } memcpy(odata, rte_pktmbuf_mtod(op->sym->m_src, void*), rte_pktmbuf_data_len(op->sym->m_src)); -- 2.5.5