From patchwork Mon Feb 4 09:36:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 2089931 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 519A4DFE82 for ; Mon, 4 Feb 2013 09:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388Ab3BDJgI (ORCPT ); Mon, 4 Feb 2013 04:36:08 -0500 Received: from mail-vb0-f45.google.com ([209.85.212.45]:61751 "EHLO mail-vb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752229Ab3BDJgH (ORCPT ); Mon, 4 Feb 2013 04:36:07 -0500 Received: by mail-vb0-f45.google.com with SMTP id p1so3765949vbi.32 for ; Mon, 04 Feb 2013 01:36:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent:x-gm-message-state; bh=gIPhL3eXGG8cPKm8v59jgQe34m5HKRr+Z//WrgOWu9k=; b=X9Zlv6+edOrMKG9wFIo0jO0xPLs7NfjxJ6ufdc8n7L9WclbgF5lYj64JqjmaMK3SbY inKrPpQuVO/nVxOGVAVil9p7U4eE5uT6Js0wHvbAffsvH5b5SizR3vFJ+MbkjJk4+p+d 9pRUN/Sb3oUuv9qqQA0DqSx1vEhGivNEqMT0MgLI0fBPNv/8sACMkHzTpF2xZ5ev2viC fwXwsbIMP2pn1nmkss9JHFVU37F9grYHdsogKYdXmiDYO3FJV0Omk4PjmH7pC6ncFEQC qnKQXam9xbtwgGPedfvwtfI4BE4aVG4h0wFy6jVqw646PbD0uWj5kwRMar8z16ygmYL4 CDMQ== X-Received: by 10.52.91.142 with SMTP id ce14mr18660874vdb.84.1359970566016; Mon, 04 Feb 2013 01:36:06 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPS id qj8sm20779221veb.2.2013.02.04.01.36.03 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 01:36:04 -0800 (PST) Date: Mon, 4 Feb 2013 11:36:00 +0200 From: Alex Netes To: linux-rdma@vger.kernel.org Cc: hal@dev.mellanox.co.il Subject: [PATCH] opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping Message-ID: <20130204093600.GA13151@calypso.mtl.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmGLxk+CCcqFCO9qd366IIU9/JZrF6wgOc3WJrvbAATn7UzwWVY+xICL1+djkn93BB6VRtB Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Fix segmentation fault in osm_torus.c. Signed-off-by: Hal Rosenstock Signed-off-by: Alex Netes Acked-by: Jim Schutt --- 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); }