[dpdk-dev] crypto: fix null pointer dereferencing
Commit Message
From: "Jain, Deepak K" <deepak.k.jain@intel.com>
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 <deepak.k.jain@intel.com>
---
drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
Hi Deepak,
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Deepak Kumar Jain
> Sent: Monday, May 23, 2016 4:47 PM
> To: Doherty, Declan
> Cc: Jain, Deepak K; dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] crypto: fix null pointer dereferencing
>
> From: "Jain, Deepak K" <deepak.k.jain@intel.com>
>
> 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 <deepak.k.jain@intel.com>
Could you change the title to "aesni_mb: fix null pointer dereferencing",
to specify that the patch is for the aesni mb pmd?
Thanks,
Pablo
@@ -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));