osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity
PATCH 1/1 osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity
From: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- opensm/osm_congestion_control.c | 5 +++++ opensm/osm_perfmgr.c | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-)
(quoted diff) +0 -0
b/opensm/osm_congestion_control.c
index ae8e3bb..1ab7307 100644
opensm/osm_congestion_control.c +0 -0
@@ -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
opensm/osm_perfmgr.c +0 -0
@@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html