public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sergei Dmitrouk" <sergei@posteo.net>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>, Zhichao Gao <zhichao.gao@intel.com>
Subject: [PATCH v1 1/2] ShellPkg/UefiShellCommandLib: suppress incorrect gcc warning
Date: Tue, 11 May 2021 22:56:15 +0000	[thread overview]
Message-ID: <20210511225616.5942-2-sergei@posteo.net> (raw)
In-Reply-To: <20210511225616.5942-1-sergei@posteo.net>

`Dupes` is used only if `Duplicates != NULL` and function is left if
allocation of memory for `Dupes` fails, so it can't be used
uninitialized.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3228
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Sergei Dmitrouk <sergei@posteo.net>
---
 ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
index b06d22592d33..81923c8ae737 100644
--- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
+++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
@@ -2128,6 +2128,11 @@ ShellSortFileList (
     }
   }
 
+  //
+  // Set Dupes to suppress incorrect compiler/analyzer warnings.
+  //
+  Dupes = NULL;
+
   //
   // If separation of duplicates has been requested, allocate the list for
   // them.
-- 
2.17.6


  reply	other threads:[~2021-05-11 22:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 22:56 [PATCH v1 0/2] "maybe-uninitialized" warnings emitted by sergei
2021-05-11 22:56 ` Sergei Dmitrouk [this message]
2021-05-14  9:19   ` [edk2-devel] [PATCH v1 1/2] ShellPkg/UefiShellCommandLib: suppress incorrect gcc warning Laszlo Ersek
2021-05-11 22:56 ` [PATCH v1 2/2] OvmfPkg/VirtioFsDxe: suppress incorrect gcc warnings Sergei Dmitrouk
2021-05-14  9:29   ` [edk2-devel] " Laszlo Ersek
2021-05-14 10:01 ` [edk2-devel] [PATCH v1 0/2] "maybe-uninitialized" warnings emitted by Laszlo Ersek

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=20210511225616.5942-2-sergei@posteo.net \
    --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