diff mbox

[03/10] opensm/osm_ucast_dfsssp.c : fix dereference null return value

Message ID 1358872782-16912-1-git-send-email-domke.j.aa@m.titech.ac.jp (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Jens Domke Jan. 22, 2013, 4:39 p.m. UTC
From: Dan Ben Yosef <danby@dev.mellanox.co.il>

Dereferencing a null pointer "remote_node"

Signed-off-by: Dan Ben Yosef <danby@dev.mellanox.co.il>
Signed-off-by: Jens Domke <domke.j.aa@m.titech.ac.jp>
---
 opensm/osm_ucast_dfsssp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c
index 013bad4..af1b062 100644
--- a/opensm/osm_ucast_dfsssp.c
+++ b/opensm/osm_ucast_dfsssp.c
@@ -815,7 +815,7 @@  static int update_channel_dep_graph(cdg_node_t ** cdg_root,
 		    osm_node_get_remote_node(local_node, local_port,
 					     &remote_port);
 		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
-		if (!remote_node->sw)
+		if (!remote_node || !remote_node->sw)
 			break;
 		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));
 
@@ -961,7 +961,7 @@  static int remove_path_from_cdg(cdg_node_t ** cdg_root, osm_port_t * src_port,
 		    osm_node_get_remote_node(local_node, local_port,
 					     &remote_port);
 		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
-		if (!remote_node->sw)
+		if (!remote_node || !remote_node->sw)
 			break;
 		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));