All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Subject: [PATCH] opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping
Date: Mon, 4 Feb 2013 11:36:00 +0200	[thread overview]
Message-ID: <20130204093600.GA13151@calypso.mtl.com> (raw)

Fix segmentation fault in osm_torus.c.

Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 opensm/osm_torus.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index 1510233..e63cb40 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -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);
 }
 
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2013-02-04  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04  9:36 Alex Netes [this message]
     [not found] ` <20130204093600.GA13151-iQai9MGU/dze+A/uUDamNg@public.gmane.org>
2013-02-04 21:56   ` [PATCH] opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping Jim Schutt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130204093600.GA13151@calypso.mtl.com \
    --to=alexne-vpraknaxozvwk0htik3j/w@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.