[ofa-general] [PATCH] opensm/opensm/osm_state_mgr.c: Add check for valid physical port before using pointer.

Ira Weiny weiny2 at llnl.gov
Tue Nov 4 09:57:44 PST 2008


>From 567c3893f24f4dc25ef5f4e74ef9deeb8ae541ad Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Mon, 3 Nov 2008 14:47:50 -0800
Subject: [PATCH] opensm/opensm/osm_state_mgr.c: Add check for valid physical port before using
 pointer.

   There are times when PortInfo fails which leaves osm_node_t with invalid
   osm_physp_t pointers.  In this case do not use an invalid pointer.

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 opensm/opensm/osm_state_mgr.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index ba3b6bf..841438c 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -542,6 +542,12 @@ static void __osm_state_mgr_get_node_desc(IN cl_map_item_t * const p_object,
 
 	/* get a physp to request from. */
 	p_physp = osm_node_get_any_physp_ptr(p_node);
+	if (!osm_physp_is_valid(p_physp)) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+			"__osm_state_mgr_get_node_desc: ERR 331C: "
+			"Failed to get valid physical port object\n");
+		goto exit;
+	}
 
 	mad_context.nd_context.node_guid = osm_node_get_node_guid(p_node);
 
-- 
1.5.4.5




More information about the general mailing list