From patchwork Tue May 31 11:30:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 832152 X-Patchwork-Delegate: alexne@voltaire.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4VBUEZ9005324 for ; Tue, 31 May 2011 11:30:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752893Ab1EaLaS (ORCPT ); Tue, 31 May 2011 07:30:18 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:61552 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488Ab1EaLaR (ORCPT ); Tue, 31 May 2011 07:30:17 -0400 Received: by wya21 with SMTP id 21so3215586wya.19 for ; Tue, 31 May 2011 04:30:16 -0700 (PDT) Received: by 10.227.169.139 with SMTP id z11mr5747083wby.60.1306841416766; Tue, 31 May 2011 04:30:16 -0700 (PDT) Received: from [192.168.1.100] (c-71-192-10-85.hsd1.ma.comcast.net [71.192.10.85]) by mx.google.com with ESMTPS id ge4sm3681012wbb.64.2011.05.31.04.30.15 (version=SSLv3 cipher=OTHER); Tue, 31 May 2011 04:30:16 -0700 (PDT) Message-ID: <4DE4D145.8060104@dev.mellanox.co.il> Date: Tue, 31 May 2011 07:30:13 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Alex Netes CC: "linux-rdma@vger.kernel.org" Subject: [PATCH] opensm/osm_ucast_mgr.c: Fix some issues found by Coverity 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.6 (demeter2.kernel.org [140.211.167.43]); Tue, 31 May 2011 11:30:19 +0000 (UTC) Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/opensm/osm_ucast_mgr.c b/opensm/osm_ucast_mgr.c index 211d6e0..600bb10 100644 --- a/opensm/osm_ucast_mgr.c +++ b/opensm/osm_ucast_mgr.c @@ -529,6 +529,7 @@ static int set_dimn_ports(void *ctx, uint64_t guid, char *p) if (!ports) { OSM_LOG(&p_subn->p_osm->log, OSM_LOG_ERROR, "ERR 3A08: cannot allocate memory for ports\n"); + free(dimn_ports); return -1; } memset(ports, 0, words*sizeof(*ports)); @@ -794,6 +795,8 @@ static void add_sw_endports_to_order_list(osm_switch_t * sw, port = osm_get_port_by_guid(m->p_subn, p->p_remote_physp-> port_guid); + if (!port) + continue; cl_qlist_insert_tail(&m->port_order_list, &port->list_item); port->flag = 1;