From patchwork Tue Jan 22 16:40:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Domke X-Patchwork-Id: 2019351 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DB3BA3FD1A for ; Tue, 22 Jan 2013 16:45:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754847Ab3AVQoa (ORCPT ); Tue, 22 Jan 2013 11:44:30 -0500 Received: from mail02.nap.gsic.titech.ac.jp ([131.112.13.21]:58851 "HELO mail02.nap.gsic.titech.ac.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754727Ab3AVQo0 (ORCPT ); Tue, 22 Jan 2013 11:44:26 -0500 X-Greylist: delayed 338 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Jan 2013 11:44:25 EST Received: from 131.112.13.36 by mail02.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(11242:0:AUTH_RELAY) (envelope-from ); Wed, 23 Jan 2013 01:40:19 +0900 (JST) Received: from [131.112.13.21] (mail02.nap.gsic.titech.ac.jp) by drweb1.nap.gsic.titech.ac.jp (Dr.Web MailD 6.0.2.0) with SMTP id 0167C4AF; Wed, 23 Jan 2013 01:40:19 Received: from 131.112.29.201 by mail02.nap.gsic.titech.ac.jp with Mail2000 ESMTP Server V6.00S(11250:0:AUTH_LOGIN) (envelope-from ); Wed, 23 Jan 2013 01:40:16 +0900 (JST) From: Jens Domke To: linux-rdma@vger.kernel.org Cc: Alex Netes , Torsten Hoefler , Dan Ben Yosef , Jens Domke Subject: [PATCH 04/10] opensm/osm_ucast_dfsssp.c : fix dereference before null check Date: Wed, 23 Jan 2013 01:40:07 +0900 Message-Id: <1358872807-16942-1-git-send-email-domke.j.aa@m.titech.ac.jp> X-Mailer: git-send-email 1.7.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Dan Ben Yosef Dereferencing "dfsssp_ctx" before a null check. Signed-off-by: Dan Ben Yosef Signed-off-by: Jens Domke --- opensm/osm_ucast_dfsssp.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c index af1b062..f88382b 100644 --- a/opensm/osm_ucast_dfsssp.c +++ b/opensm/osm_ucast_dfsssp.c @@ -2069,14 +2069,16 @@ static uint8_t get_dfsssp_sl(void *context, uint8_t hint_for_default_sl, const ib_net16_t slid, const ib_net16_t dlid) { dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context; - osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr; osm_port_t *src_port, *dest_port; vltable_t *srcdest2vl_table = NULL; + osm_ucast_mgr_t *p_mgr = NULL; int32_t res = 0; if (dfsssp_ctx - && dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP) + && dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP) { + p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr; srcdest2vl_table = (vltable_t *) (dfsssp_ctx->srcdest2vl_table); + } else return hint_for_default_sl;