[ofa-general] [PATCH] OpenSM/osm_ucast_ftree.c: Possible NULL ptr seg fault

Hal Rosenstock hrosenstock at xsigo.com
Wed Sep 19 06:00:55 PDT 2007


In osm_ucast_ftree.c:__osm_ftree_rank_leaf_switches, protect against
NULL return from osm_node_get_remote_node

Signed-off-by: Hal Rosenstock <hal at xsigo.com>

diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 5d48c6e..d8ba368 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -2885,6 +2885,8 @@ __osm_ftree_rank_leaf_switches(IN ftree_fabric_t * p_ftree,
 
 		p_remote_osm_node =
 		    osm_node_get_remote_node(p_osm_node, i, NULL);
+		if (!p_remote_osm_node)
+			continue;
 
 		switch (osm_node_get_type(p_remote_osm_node)) {
 		case IB_NODE_TYPE_CA:




More information about the general mailing list