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>
This commit is contained in:
Sergei Dmitrouk 2021-05-11 22:56:16 +00:00 committed by mergify[bot]
parent eec44cdd00
commit d82c4693f8
1 changed files with 11 additions and 0 deletions

View File

@ -332,6 +332,12 @@ VirtioFsSimpleFileOpen (
return EFI_INVALID_PARAMETER;
}
//
// 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.
@ -426,6 +432,11 @@ VirtioFsSimpleFileOpen (
goto FreeNewCanonicalPath;
}
//
// Set NewNodeIsDirectory to suppress incorrect compiler/analyzer warnings.
//
NewNodeIsDirectory = FALSE;
//
// Try to open LastComponent directly under DirNodeId, as an existent regular
// file or directory.