From patchwork Wed Oct 14 14:45:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 53690 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9EEnSC5004262 for ; Wed, 14 Oct 2009 14:49:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932121AbZJNOpq (ORCPT ); Wed, 14 Oct 2009 10:45:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933416AbZJNOpq (ORCPT ); Wed, 14 Oct 2009 10:45:46 -0400 Received: from qmta03.westchester.pa.mail.comcast.net ([76.96.62.32]:41111 "EHLO QMTA03.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbZJNOpp (ORCPT ); Wed, 14 Oct 2009 10:45:45 -0400 Received: from OMTA20.westchester.pa.mail.comcast.net ([76.96.62.71]) by QMTA03.westchester.pa.mail.comcast.net with comcast id saux1c0041YDfWL53eitDG; Wed, 14 Oct 2009 14:42:53 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA20.westchester.pa.mail.comcast.net with comcast id sepz1c00J0hNrtn3gepzf3; Wed, 14 Oct 2009 14:50:00 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id n9EEk1wq004956; Wed, 14 Oct 2009 10:46:06 -0400 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id n9EEjdEI004925; Wed, 14 Oct 2009 10:45:39 -0400 Date: Wed, 14 Oct 2009 10:45:38 -0400 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCHv2] opensm/osm_ucast_updn.c: Reduce temporary allocation of cas_per_sw Message-ID: <20091014144538.GA4921@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c index bb9ccda..ced076a 100644 --- a/opensm/opensm/osm_ucast_updn.c +++ b/opensm/opensm/osm_ucast_updn.c @@ -2,6 +2,7 @@ * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. + * Copyright (c) 2009 HNR Consulting. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -431,13 +432,13 @@ static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn) "Current number of ports in the subnet is %d\n", cl_qmap_count(&p_osm->subn.port_guid_tbl)); - cas_per_sw = malloc((IB_LID_UCAST_END_HO + 1) * sizeof(*cas_per_sw)); + cas_per_sw = malloc(p_osm->subn.max_ucast_lid_ho * sizeof(*cas_per_sw)); if (!cas_per_sw) { OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR AA14: " "cannot alloc mem for CAs per switch counter array\n"); goto _exit; } - memset(cas_per_sw, 0, (IB_LID_UCAST_END_HO + 1) * sizeof(*cas_per_sw)); + memset(cas_per_sw, 0, p_osm->subn.max_ucast_lid_ho * sizeof(*cas_per_sw)); /* Find the Maximum number of CAs (and routers) for histogram normalization */ OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,