[10/14] net/bnxt: fix dereference of a null pointer
diff mbox series

Message ID 20200717141451.11705-11-somnath.kotur@broadcom.com
State Superseded, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • bnxt patches
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur July 17, 2020, 2:14 p.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Avoid dereferencing a null pointer.

Fixes: 313ac35ac701 ("net/bnxt: support ULP session manager init")

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
index b2c8c34..4df850f 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c
@@ -120,9 +120,11 @@  ulp_mark_db_init(struct bnxt_ulp_context *ctxt)
 	return 0;
 
 mem_error:
-	rte_free(mark_tbl->gfid_tbl);
-	rte_free(mark_tbl->lfid_tbl);
-	rte_free(mark_tbl);
+	if (mark_tbl) {
+		rte_free(mark_tbl->gfid_tbl);
+		rte_free(mark_tbl->lfid_tbl);
+		rte_free(mark_tbl);
+	}
 	BNXT_TF_DBG(DEBUG, "Failed to allocate memory for mark mgr\n");
 	return -ENOMEM;
 }