From patchwork Fri Jul 20 02:50:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Honggang LI X-Patchwork-Id: 10535899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F755600D0 for ; Fri, 20 Jul 2018 02:51:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10D3A298A6 for ; Fri, 20 Jul 2018 02:51:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04CCE299DA; Fri, 20 Jul 2018 02:51:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAA8E298A6 for ; Fri, 20 Jul 2018 02:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731035AbeGTDhZ (ORCPT ); Thu, 19 Jul 2018 23:37:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54570 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730514AbeGTDhZ (ORCPT ); Thu, 19 Jul 2018 23:37:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3930402B03F; Fri, 20 Jul 2018 02:51:23 +0000 (UTC) Received: from dhcp-129-124.nay.redhat.com (unknown [10.66.129.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59F99111E406; Fri, 20 Jul 2018 02:51:22 +0000 (UTC) From: Honggang LI To: hal@mellanox.com Cc: linux-rdma@vger.kernel.org, Honggang Li Subject: [PATCH 4/6] Fix maybe uninitialized issue Date: Fri, 20 Jul 2018 10:50:36 +0800 Message-Id: <20180720025038.9365-5-honli@redhat.com> In-Reply-To: <20180720025038.9365-4-honli@redhat.com> References: <20180720025038.9365-1-honli@redhat.com> <20180720025038.9365-2-honli@redhat.com> <20180720025038.9365-3-honli@redhat.com> <20180720025038.9365-4-honli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 20 Jul 2018 02:51:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 20 Jul 2018 02:51:24 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'honli@redhat.com' RCPT:'' Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Honggang Li make[2]: Entering directory '/home/honli/upstream-repos/opensm/opensm' depbase=`echo osm_sa_mcmember_record.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -I../include -I../include/opensm -I./../include -I./../../libibumad/include -I/usr/local/include -Werror -Wall -Wwrite-strings -g -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE=1 -g -O2 -MT osm_sa_mcmember_record.o -MD -MP -MF $depbase.Tpo -c -o osm_sa_mcmember_record.o osm_sa_mcmember_record.c &&\ mv -f $depbase.Tpo $depbase.Po osm_sa_mcmember_record.c: In function ‘osm_mcmr_rcv_process’: osm_sa_mcmember_record.c:1579:3: error: ‘port_gid’ may be used uninitialized in this function [-Werror=maybe-uninitialized] memcpy(&(match_rec.port_gid), &port_gid, sizeof(ib_gid_t)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ osm_sa_mcmember_record.c:1478:11: note: ‘port_gid’ was declared here ib_gid_t port_gid; ^~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Honggang Li --- opensm/osm_sa_mcmember_record.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c index dc805bcf64f8..db2188e5de5a 100644 --- a/opensm/osm_sa_mcmember_record.c +++ b/opensm/osm_sa_mcmember_record.c @@ -1478,6 +1478,8 @@ static void mcmr_by_comp_mask(osm_sa_t * sa, const ib_member_rec_t * p_rcvd_rec, ib_gid_t port_gid; boolean_t proxy_join = FALSE; + memset(&port_gid, 0, sizeof(port_gid)); + OSM_LOG_ENTER(sa->p_log); OSM_LOG(sa->p_log, OSM_LOG_DEBUG,