Skip to contentSkip to conversation

opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping

PATCH In review Alex Netes 2 participants 2 messages Feb 4, 2013 1 message not in the archive InfiniBand

lore
Share & tools
lore

Alex Netes

author
#0 lore raw

PATCH 1/1 opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping

Fix segmentation fault in osm_torus.c.

---
 opensm/osm_torus.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
opensm/osm_torus.c +6 -5
index 1510233..e63cb40 100644
@@ -7517,11 +7517,12 @@ void dump_torus(struct torus *t)
 	for (k = 0; k < z_sz; k++)
 		for (j = 0; j < y_sz; j++)
 			for (i = 0; i < x_sz; i++)
-				fprintf(file, "switch %u,%u,%u GUID 0x%04"
-					PRIx64 " (%s)\n",
-					i, j, k,
-					cl_ntoh64(t->sw[i][j][k]->n_id),
-					t->sw[i][j][k]->osm_switch->p_node->print_desc);
+				if (t->sw[i][j][k])
+					fprintf(file, "switch %u,%u,%u GUID 0x%04"
+						PRIx64 " (%s)\n",
+						i, j, k,
+						cl_ntoh64(t->sw[i][j][k]->n_id),
+						t->sw[i][j][k]->osm_switch->p_node->print_desc);
 	fclose(file);
 }
 
Signature · 6 lines
1.7.11.7

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

A message that is not in the archive (sent off-list or not yet received): 20130204093600.GA13151-iQai9MGU/dze+A/[email protected]