From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbdCNRKm (ORCPT ); Tue, 14 Mar 2017 13:10:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57818 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752459AbdCNRKl (ORCPT ); Tue, 14 Mar 2017 13:10:41 -0400 Subject: Re: [PATCH] scsi: storvsc: Add support for FC rport. To: Stephen Hemminger References: <1489507263-21365-1-git-send-email-cavery@redhat.com> <20170314094221.336a1be2@xeon-e3> Cc: kys@microsoft.com, hch@infradead.org, haiyangz@microsoft.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, dan.carpenter@oracle.com, linux-scsi@vger.kernel.org From: Cathy Avery Message-ID: <58C8240E.9030907@redhat.com> Date: Tue, 14 Mar 2017 13:10:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20170314094221.336a1be2@xeon-e3> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 14 Mar 2017 17:10:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Good catch. Thanks! On 03/14/2017 12:42 PM, Stephen Hemminger wrote: > On Tue, 14 Mar 2017 12:01:03 -0400 > Cathy Avery wrote: > >> #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) >> if (host->transportt == fc_transport_template) { >> + struct fc_rport_identifiers ids; >> + >> + ids.node_name = 0; >> + ids.port_name = 0; >> + ids.port_id = 0; >> + ids.roles |= FC_PORT_ROLE_FCP_TARGET; > Since the variable ids is on the stack, it is uninitialized data. > Doing a OR with uninitialized data is not correct. > > Better off to use C99 style iniatializer and skip the zero fields. > > struct fc_rport_identifiers ids = { > .roles = FC_PORT_ROLE_FCP_TARGET, > };