compress/octeontx: fix null pointer dereference
PATCH 1/1 compress/octeontx: fix null pointer dereference
Check for memory allocation failure is added to avoid null pointer dereference.
Signed-off-by Weiguo Li <[email protected]>
--- drivers/compress/octeontx/otx_zip_pmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/compress/octeontx/otx_zip_pmd.c +5 -1
@@ -392,6 +392,8 @@ zip_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id, } name =rte_malloc (NULL ,RTE_COMPRESSDEV_NAME_MAX_LEN ,0 ); +if (name ==NULL ) +return (-ENOMEM );snprintf (name,RTE_COMPRESSDEV_NAME_MAX_LEN ,"zip_pmd_%u_qp_%u" , dev->data->dev_id, qp_id);
@@ -399,8 +401,10 @@ zip_pmd_qp_setup(struct rte_compressdev *dev, uint16_t qp_id,/* Allocate the queue pair data structure. */ qp =rte_zmalloc_socket (name,sizeof (*qp),RTE_CACHE_LINE_SIZE , socket_id); -if (qp ==NULL ) +if (qp ==NULL ) { +rte_free (name);return (-ENOMEM ); + } qp->name = name;
Signature · 1 line
2.25.1
Quoted 5 lines
Check for memory allocation failure is added to avoid null pointer dereference.
Signed-off-by Weiguo Li <[email protected]>---
Acked-by Akhil Goyal <[email protected]>
Applied to dpdk-next-crypto
Added Fixes tag