aesni_mb: fix null pointer dereferencing
authorDeepak Kumar Jain <deepak.k.jain@intel.com>
Tue, 7 Jun 2016 09:36:11 +0000 (10:36 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 7 Jun 2016 14:36:20 +0000 (16:36 +0200)
Fix null pointer dereferencing by reporting if null and
exiting the function.

Coverity issue: 126584
Fixes: c0f87eb5252b ("cryptodev: change burst API to be crypto op oriented")

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c

index 9c42f88..31784e1 100644 (file)
@@ -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));