summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioFsDxe
diff options
context:
space:
mode:
authorSergei Dmitrouk <sergei@posteo.net>2021-05-11 22:56:16 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-05-14 10:00:13 +0000
commitd82c4693f8d5c6b05f40ccf351c84645201067c1 (patch)
tree9a2505f24e14756cc5700daa633df9d255270f50 /OvmfPkg/VirtioFsDxe
parenteec44cdd0058ad208fa730796a306eae9138db58 (diff)
downloadedk2-d82c4693f8d5c6b05f40ccf351c84645201067c1.tar.gz
edk2-d82c4693f8d5c6b05f40ccf351c84645201067c1.tar.bz2
edk2-d82c4693f8d5c6b05f40ccf351c84645201067c1.zip
OvmfPkg/VirtioFsDxe: suppress incorrect gcc warnings
`CreateDirectoryIfCreating` is used only if `PermitCreation` is set. `NewNodeIsDirectory` might not set in case of error, but that would lead to leaving the function before invalid use. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3228 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Sergei Dmitrouk <sergei@posteo.net> Message-Id: <20210511225616.5942-3-sergei@posteo.net> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/VirtioFsDxe')
-rw-r--r--OvmfPkg/VirtioFsDxe/SimpleFsOpen.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
index d73d23fe86..9e46e8ab83 100644
--- a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
+++ b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c
@@ -333,6 +333,12 @@ VirtioFsSimpleFileOpen (
}
//
+ // Set CreateDirectoryIfCreating to suppress incorrect compiler/analyzer
+ // warnings.
+ //
+ CreateDirectoryIfCreating = FALSE;
+
+ //
// Validate the Attributes requested for the case when the file ends up being
// created, provided creation is permitted.
//
@@ -427,6 +433,11 @@ VirtioFsSimpleFileOpen (
}
//
+ // Set NewNodeIsDirectory to suppress incorrect compiler/analyzer warnings.
+ //
+ NewNodeIsDirectory = FALSE;
+
+ //
// Try to open LastComponent directly under DirNodeId, as an existent regular
// file or directory.
//