From patchwork Tue Feb 4 14:56:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3576431 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1C5B49F2F5 for ; Tue, 4 Feb 2014 14:56:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 432FD20166 for ; Tue, 4 Feb 2014 14:56:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 517E620163 for ; Tue, 4 Feb 2014 14:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754065AbaBDO4m (ORCPT ); Tue, 4 Feb 2014 09:56:42 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:52757 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604AbaBDO4l (ORCPT ); Tue, 4 Feb 2014 09:56:41 -0500 Received: by mail-wg0-f51.google.com with SMTP id z12so13077886wgg.30 for ; Tue, 04 Feb 2014 06:56:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=jJFZYwl+t5ou1RBIheDdX1DLUq6WmWTntxRXeHCWhF0=; b=LYKS5x77VoLF3c7WNLaTfnZ4UdzvVQjku/FzCIE78ASBRwMThFqZrCdRnyYNhp4++p LmiNzokCyHLBDjVXXb5sIhZg37IST74oxvXhYSR98230/NuZMg1521KmP7s0vu4heQaq 9dpTFl3RJrfgpYcO837/Bprrg3GkTFnlKTfNMNLolkhl77OshbvMAnb+DvjrVI0nvWBc jPpoDAdARFBg9iFHVnT/N272xRHWeZMtiqeIw8S+DZ6W6Rbp83YsA+/QNqcqJTU+63YC Zeh3hoViNX61VuqB6X3dX3Pejq3/SEAe4YCU1SsfLwCE9AXnJPW57DcyAXpJrokkMgfj Q9lQ== X-Gm-Message-State: ALoCoQnDn0mrq00Dn4MTVlPABS/5s8dVOy8MlXajNwO4jIBiD8brzmZyEQaxJfeLYK14hLZVHQrg X-Received: by 10.180.109.16 with SMTP id ho16mr10944769wib.3.1391525800899; Tue, 04 Feb 2014 06:56:40 -0800 (PST) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id pm2sm22089840wic.0.2014.02.04.06.56.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 06:56:40 -0800 (PST) Message-ID: <52F0FFA4.6000807@dev.mellanox.co.il> Date: Tue, 04 Feb 2014 09:56:36 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Alex Netes , Jens Domke Subject: [PATCH opensm] osm_qos.c: Fix possible seg fault Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alex Netes Pointed-out-by: Jens Domke Introduced by commit 1633550020087f3296dbc2f7b1dd533cd83a6398 If force_update is set, p_tbl isn't initialized Signed-off-by: Alex Netes --- opensm/osm_qos.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/opensm/osm_qos.c b/opensm/osm_qos.c index f55a509..b174f66 100644 --- a/opensm/osm_qos.c +++ b/opensm/osm_qos.c @@ -248,8 +248,9 @@ static ib_api_status_t sl2vl_update_table(osm_sm_t * sm, osm_physp_t * p, tbl.raw_vl_by_sl[i] = (vl1 << 4) | vl2; } - if (!force_update && (p_tbl = osm_physp_get_slvl_tbl(p, in_port)) && - !memcmp(p_tbl, &tbl, sizeof(tbl))) + p_tbl = osm_physp_get_slvl_tbl(p, in_port); + + if (!force_update && !memcmp(p_tbl, &tbl, sizeof(tbl))) return IB_SUCCESS; p_mad = osm_qos_mad_create(sm, p, sizeof(tbl), (uint8_t *) & tbl,