diff mbox

[opensm] osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity

Message ID 51F7D7F7.3080004@dev.mellanox.co.il (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Hal Rosenstock July 30, 2013, 3:12 p.m. UTC
From: Alex Netes <alexne@mellanox.com>

p_req_madw could be NULL before calling mad_recv_callback().
In CC and PM managers added ASSERTs to validate p_madw/p_req_madw
pointers.

Signed-off-by: Alex Netes <alexne@mellanox.com>
---
 opensm/osm_congestion_control.c |    5 +++++
 opensm/osm_perfmgr.c            |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/opensm/osm_congestion_control.c
b/opensm/osm_congestion_control.c
index ae8e3bb..1ab7307 100644
--- a/opensm/osm_congestion_control.c
+++ b/opensm/osm_congestion_control.c
@@ -626,6 +626,11 @@  static void cc_mad_recv_callback(osm_madw_t *
p_madw, void *bind_context,
  	OSM_LOG_ENTER(p_cc->log);
 +	CL_ASSERT(p_madw);
+
+	/* HACK - should be extended when supporting CC traps */
+	CL_ASSERT(p_req_madw != NULL);
+
 	osm_madw_copy_context(p_madw, p_req_madw);
 	osm_mad_pool_put(p_cc->mad_pool, p_req_madw);
 diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index a9b4c40..67cf187 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -175,6 +175,9 @@  static void perfmgr_mad_recv_callback(osm_madw_t *
p_madw, void *bind_context,
  	OSM_LOG_ENTER(pm->log);
 +	CL_ASSERT(p_madw);
+	CL_ASSERT(p_req_madw != NULL);
+
 	osm_madw_copy_context(p_madw, p_req_madw);
 	osm_mad_pool_put(pm->mad_pool, p_req_madw);
 -- 1.7.8.2