[edk2-devel] [PATCH v1 1/2] ShellPkg/UefiShellCommandLib: suppress incorrect gcc warning

Sergei Dmitrouk sergei at posteo.net
Tue May 11 22:56:15 UTC 2021


`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 at intel.com>
Cc: Zhichao Gao <zhichao.gao at intel.com>
Signed-off-by: Sergei Dmitrouk <sergei at 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75046): https://edk2.groups.io/g/devel/message/75046
Mute This Topic: https://groups.io/mt/82760957/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list