[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-rdma
Subject:    [PATCH opensm] osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity
From:       Hal Rosenstock <hal () dev ! mellanox ! co ! il>
Date:       2013-07-30 15:12:55
Message-ID: 51F7D7F7.3080004 () dev ! mellanox ! co ! il
[Download RAW message or body]

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(-)

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

--
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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic