From patchwork Tue Jul 30 15:12:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2835735 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 073299F7D6 for ; Tue, 30 Jul 2013 15:13:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BF25201D5 for ; Tue, 30 Jul 2013 15:13:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B17702017E for ; Tue, 30 Jul 2013 15:13:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754289Ab3G3PND (ORCPT ); Tue, 30 Jul 2013 11:13:03 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:50848 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751551Ab3G3PNC (ORCPT ); Tue, 30 Jul 2013 11:13:02 -0400 Received: by mail-wg0-f43.google.com with SMTP id z12so6209638wgg.22 for ; Tue, 30 Jul 2013 08:13:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=dA1hy0GaPDXd6ZGZz0+AatT7ZeSFgC7js0YTCPd8piY=; b=FoLFGZ0/6KXWlWWHtaRWcHRb82LSLl7o4oViZrIrL43qAOyAtniqBva+qVnz1I+mIZ 8qa96gdOVuRLPNFbE4NqPZLIJEIykhCcCLCPdZ1QZzn3MWSLuZyLKPj/DSpolMSYBN+O xYyyh6iSkMscjNPeeXXLHYNkBvYHExbl4KHORYK1/mNo8xJoSrg6zZEuI5LeLkYOULTa tnzMpDT3Uq3z0EuVdKkpn7F2h8KuyjgotILjDOmuP6sPlaex0Q6ooSGngGNCIOAN9n9v mJMWN6wsXq8MDFsEcfag83ZndeofCgjrB/clqjUGQTlqYtEOuNDovYQkjgtH+hsW6bFj rtCw== X-Received: by 10.180.88.228 with SMTP id bj4mr1373456wib.2.1375197181058; Tue, 30 Jul 2013 08:13:01 -0700 (PDT) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPSA id hb2sm29120050wib.0.2013.07.30.08.12.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jul 2013 08:13:00 -0700 (PDT) Message-ID: <51F7D7F7.3080004@dev.mellanox.co.il> Date: Tue, 30 Jul 2013 11:12:55 -0400 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 Subject: [PATCH opensm] osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity X-Gm-Message-State: ALoCoQmSvRdJ08c6Pt99KKkaQY5+a9H9HC3Q1SOs+Ufii/5st6+qutx1lvXuJaJ/2y9f3qy9I9DC Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 p_req_madw could be NULL before calling mad_recv_callback(). In CC and PM managers added ASSERTs to validate p_madw/p_req_madw pointers. Signed-off-by: Alex Netes --- opensm/osm_congestion_control.c | 5 +++++ opensm/osm_perfmgr.c | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) -- 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_congestion_control.c b/opensm/osm_congestion_control.c index ae8e3bb..1ab7307 100644 --- a/opensm/osm_congestion_control.c +++ b/opensm/osm_congestion_control.c @@ -626,6 +626,11 @@ static void cc_mad_recv_callback(osm_madw_t * p_madw, void *bind_context, OSM_LOG_ENTER(p_cc->log); + CL_ASSERT(p_madw); + + /* HACK - should be extended when supporting CC traps */ + CL_ASSERT(p_req_madw != NULL); + osm_madw_copy_context(p_madw, p_req_madw); osm_mad_pool_put(p_cc->mad_pool, p_req_madw); diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c index a9b4c40..67cf187 100644 --- a/opensm/osm_perfmgr.c +++ b/opensm/osm_perfmgr.c @@ -175,6 +175,9 @@ static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context, OSM_LOG_ENTER(pm->log); + CL_ASSERT(p_madw); + CL_ASSERT(p_req_madw != NULL); + osm_madw_copy_context(p_madw, p_req_madw); osm_mad_pool_put(pm->mad_pool, p_req_madw); -- 1.7.8.2