From patchwork Fri Jun 3 00:40:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 845372 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 p530eUUQ010560 for ; Fri, 3 Jun 2011 00:40:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754394Ab1FCAk2 (ORCPT ); Thu, 2 Jun 2011 20:40:28 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:61463 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754382Ab1FCAk1 (ORCPT ); Thu, 2 Jun 2011 20:40:27 -0400 Received: by wwa36 with SMTP id 36so1160181wwa.1 for ; Thu, 02 Jun 2011 17:40:26 -0700 (PDT) Received: by 10.227.184.5 with SMTP id ci5mr1301285wbb.8.1307061625825; Thu, 02 Jun 2011 17:40:25 -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 fm14sm706441wbb.7.2011.06.02.17.40.23 (version=SSLv3 cipher=OTHER); Thu, 02 Jun 2011 17:40:24 -0700 (PDT) Message-ID: <4DE82D75.8030506@dev.mellanox.co.il> Date: Thu, 02 Jun 2011 20:40:21 -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_switch.c: In switch_find_guid_common, handle NULL parameter 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]); Fri, 03 Jun 2011 00:40:31 +0000 (UTC) Since port->priv can be NULL, struct osm_remote_guids_count * supplied can be NULL so handle this. 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_switch.c b/opensm/osm_switch.c index 9785a9d..fbb8292 100644 --- a/opensm/osm_switch.c +++ b/opensm/osm_switch.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. - * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved. * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. * @@ -177,6 +177,9 @@ switch_find_guid_common(IN const osm_switch_t * p_sw, CL_ASSERT(p_sw); + if (!r) + goto out; + p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num); p_rem_physp = osm_physp_get_remote(p_physp); p_rem_node = osm_physp_get_node_ptr(p_rem_physp); @@ -193,6 +196,7 @@ switch_find_guid_common(IN const osm_switch_t * p_sw, } } +out: return p_remote_guid; }