public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, gaoliming@byosoft.com.cn
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>,
	sergei@posteo.net
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg: Initialize local variable value before they are used
Date: Thu, 11 Mar 2021 18:21:44 +0100	[thread overview]
Message-ID: <1b5cdecc-35f5-cfa1-914a-e2b674fe66b6@redhat.com> (raw)
In-Reply-To: <20210309012416.1981-1-gaoliming@byosoft.com.cn>

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 <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  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


  parent reply	other threads:[~2021-03-11 17:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09  1:24 [PATCH] MdeModulePkg: Initialize local variable value before they are used gaoliming
2021-03-09  2:10 ` Wu, Hao A
2021-03-11  1:10   ` 回复: " gaoliming
2021-03-11  1:32     ` [edk2-devel] " Wu, Hao A
2021-03-11 17:21 ` Laszlo Ersek [this message]
2021-03-15  2:57   ` 回复: [edk2-devel] " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b5cdecc-35f5-cfa1-914a-e2b674fe66b6@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox