From patchwork Fri Nov 6 14:14:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 58047 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 nA6EF3os019247 for ; Fri, 6 Nov 2009 14:15:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757003AbZKFOO6 (ORCPT ); Fri, 6 Nov 2009 09:14:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756026AbZKFOO6 (ORCPT ); Fri, 6 Nov 2009 09:14:58 -0500 Received: from qmta08.westchester.pa.mail.comcast.net ([76.96.62.80]:48920 "EHLO QMTA08.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757376AbZKFOO5 (ORCPT ); Fri, 6 Nov 2009 09:14:57 -0500 Received: from OMTA21.westchester.pa.mail.comcast.net ([76.96.62.72]) by QMTA08.westchester.pa.mail.comcast.net with comcast id 1ny61d0071ZXKqc58qDtLW; Fri, 06 Nov 2009 14:13:53 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA21.westchester.pa.mail.comcast.net with comcast id 1qNE1d0020hNrtn3hqNEuT; Fri, 06 Nov 2009 14:22:15 +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 nA6EEI3G019741; Fri, 6 Nov 2009 09:14:24 -0500 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id nA6EE2LK019709; Fri, 6 Nov 2009 09:14:02 -0500 Date: Fri, 6 Nov 2009 09:14:02 -0500 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm: Only clear SMP beyond end of PortInfo attribute Message-ID: <20091106141402.GA19699@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_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c index 145be1c..5529033 100644 --- a/opensm/opensm/osm_lid_mgr.c +++ b/opensm/opensm/osm_lid_mgr.c @@ -865,8 +865,9 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr, Third, send the SMP to this physical port. */ - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_old_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); /* Should never write back a value that is bigger then 3 in diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c index 2477f2c..bcfc269 100644 --- a/opensm/opensm/osm_link_mgr.c +++ b/opensm/opensm/osm_link_mgr.c @@ -152,8 +152,9 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp, esp0 = TRUE; } - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_old_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); /* Should never write back a value that is bigger then 3 in diff --git a/opensm/opensm/osm_pkey_mgr.c b/opensm/opensm/osm_pkey_mgr.c index 6666be2..de79e3d 100644 --- a/opensm/opensm/osm_pkey_mgr.c +++ b/opensm/opensm/osm_pkey_mgr.c @@ -200,8 +200,9 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm, return IB_SUCCESS; } - memset(payload, 0, IB_SMP_DATA_SIZE); memcpy(payload, p_pi, sizeof(ib_port_info_t)); + memset(payload + sizeof(ib_port_info_t), 0, + IB_SMP_DATA_SIZE - sizeof(ib_port_info_t)); p_pi = (ib_port_info_t *) payload; if (enforce == TRUE)