From patchwork Fri Sep 17 17:03:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Schutt X-Patchwork-Id: 188732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8HH3U25024660 for ; Fri, 17 Sep 2010 17:03:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752168Ab0IQRDb (ORCPT ); Fri, 17 Sep 2010 13:03:31 -0400 Received: from sentry-three.sandia.gov ([132.175.109.17]:35839 "EHLO sentry-three.sandia.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752191Ab0IQRD3 (ORCPT ); Fri, 17 Sep 2010 13:03:29 -0400 X-WSS-ID: 0L8WI1O-0C-5S7-02 X-M-MSG: Received: from sentry.sandia.gov (mm03snlnto.sandia.gov [132.175.109.20]) by sentry-three.sandia.gov (Postfix) with ESMTP id 16E834CDB66; Fri, 17 Sep 2010 11:03:23 -0600 (MDT) Received: from [132.175.109.1] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.2)); Fri, 17 Sep 2010 11:03:17 -0600 X-Server-Uuid: 6BFC7783-7E22-49B4-B610-66D6BE496C0E Received: from localhost.localdomain (sale659.sandia.gov [134.253.4.20]) by mailgate.sandia.gov (8.14.4/8.14.4) with ESMTP id o8HH36vX003515; Fri, 17 Sep 2010 11:03:08 -0600 From: "Jim Schutt" To: sashak@voltaire.com cc: linux-rdma@vger.kernel.org, "Jim Schutt" Subject: [PATCH 2/2] opensm/osm_torus.c: Handle calloc() failure on routing engine context creation. Date: Fri, 17 Sep 2010 11:03:14 -0600 Message-ID: <1284742994-24503-3-git-send-email-jaschut@sandia.gov> X-Mailer: git-send-email 1.6.2.2 In-Reply-To: <1284742994-24503-1-git-send-email-jaschut@sandia.gov> References: <1284742994-24503-1-git-send-email-jaschut@sandia.gov> X-PMX-Version: 5.6.0.2009776, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.9.17.165415 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_LESS 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, BODY_SIZE_900_999 0, DATE_TZ_NA 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __URI_NS ' X-TMWD-Spam-Summary: TS=20100917170319; ID=1; SEV=2.3.1; DFV=B2010090808; IFV=NA; AIF=B2010090808; RPD=5.03.0010; ENG=NA; RPDID=7374723D303030312E30413031303230312E34433933394635362E303146343A534346535441543838363133332C73733D312C6667733D30; CAT=NONE; CON=NONE; SIG=AAAAAAAAAAAAAAAAAAAAAAAAfQ== X-MMS-Spam-Filter-ID: B2010090808_5.03.0010 MIME-Version: 1.0 X-WSS-ID: 608D40DF2JS2865468-01-01 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 17 Sep 2010 17:03:31 +0000 (UTC) diff --git a/opensm/opensm/osm_torus.c b/opensm/opensm/osm_torus.c index 12b480d..3b67f16 100644 --- a/opensm/opensm/osm_torus.c +++ b/opensm/opensm/osm_torus.c @@ -410,7 +410,11 @@ struct torus_context *torus_context_create(osm_opensm_t *osm) struct torus_context *ctx; ctx = calloc(1, sizeof(*ctx)); - ctx->osm = osm; + if (ctx) + ctx->osm = osm; + else + OSM_LOG(&osm->log, OSM_LOG_ERROR, + "Error: calloc: %s\n", strerror(errno)); return ctx; } @@ -9113,6 +9117,8 @@ int osm_ucast_torus2QoS_setup(struct osm_routing_engine *r, struct torus_context *ctx; ctx = torus_context_create(osm); + if (!ctx) + return -1; r->context = ctx; r->ucast_build_fwd_tables = torus_build_lfts;