From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.578.1615483312784552447 for ; Thu, 11 Mar 2021 09:21:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AXGB/TYQ; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615483311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RwjzVg2G578zf/dSbw5gt+G8mzbQA74X5AMdFYXLWLg=; b=AXGB/TYQxrJqvP30P0+NoGQ1IcsTZO2BW5G1IadQtMcl3cqYlz47Xk8/jL2XPbzHlNJ6IF DKIuYFc33yNFgCfu8mYR2DNyNy2BszXM153T/YiHbwBgqMe/ArSHgA9iPCrtD/16IzziMy JfxYJN9S7BMYCtNluO4Dj1EhUppA1+A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-K35i-ntmPTygHzbdxcpFOg-1; Thu, 11 Mar 2021 12:21:47 -0500 X-MC-Unique: K35i-ntmPTygHzbdxcpFOg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C4BB108BD06; Thu, 11 Mar 2021 17:21:46 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-158.ams2.redhat.com [10.36.115.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AC962C159; Thu, 11 Mar 2021 17:21:44 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdeModulePkg: Initialize local variable value before they are used To: devel@edk2.groups.io, gaoliming@byosoft.com.cn Cc: Jian J Wang , Hao A Wu , sergei@posteo.net References: <20210309012416.1981-1-gaoliming@byosoft.com.cn> From: "Laszlo Ersek" Message-ID: <1b5cdecc-35f5-cfa1-914a-e2b674fe66b6@redhat.com> Date: Thu, 11 Mar 2021 18:21:44 +0100 MIME-Version: 1.0 In-Reply-To: <20210309012416.1981-1-gaoliming@byosoft.com.cn> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Liming, On 03/09/21 02:24, gaoliming wrote: > This change is to fix the compiler error on GCC49 release build. > > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Liming Gao > --- > MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c | 1 + > .../Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > index e99a812a44..0779f94f9e 100644 > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c > @@ -1122,6 +1122,7 @@ AhciDmaTransfer ( > > Map = NULL; > PciIo = Instance->PciIo; > + Status = EFI_SUCCESS; > > if (PciIo == NULL) { > return EFI_INVALID_PARAMETER; > diff --git a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c > index 0c9299c8b0..7822cbf4bb 100644 > --- a/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c > +++ b/MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.c > @@ -117,6 +117,7 @@ CreateBasicVariablePolicy ( > > // Now we've gotta determine the total size of the buffer required for > // the VariablePolicy structure. > + NameSize = 0; > TotalSize = sizeof( VARIABLE_POLICY_ENTRY ); > if (Name != NULL) { > NameSize = StrnSizeS( Name, MAX_UINT16 ); > (1) we have a bugzilla ticket related to this (or more precisely, overlapping AtaAtapiPassThru): https://bugzilla.tianocore.org/show_bug.cgi?id=3228 I think mentioning the BZ in the commit message might make sense. (2) Recently we have used a special comment format for such assignments. Namely: // // Set Status to suppress incorrect compiler/analyzer warnings // Status = EFI_SUCCESS; Hao already requested that we should document that we only suppress compiler false positives with these assignments -- they are not needed functionally. However, I think saying so in the commit message *only* is not sufficient. I think we should stick with the above code-comment format (which we've used recently in several places). Thanks! Laszlo