Re: [edk2-devel] [PATCH v1 2/2] OvmfPkg/VirtioFsDxe: suppress incorrect gcc warnings
On 05/12/21 00:56, Sergei Dmitrouk wrote: > `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 > Cc: Ard Biesheuvel > Cc: Jordan Justen > Signed-off-by: Sergei Dmitrouk > --- > OvmfPkg/VirtioFsDxe/SimpleFsOpen.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c > b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c > index d73d23fe8665..9e46e8ab8385 100644 > --- a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c > +++ b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c > @@ -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. > Reviewed-by: Laszlo Ersek -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75111): https://edk2.groups.io/g/devel/message/75111 Mute This Topic: https://groups.io/mt/82760960/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v1 2/2] 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 Cc: Ard Biesheuvel Cc: Jordan Justen Signed-off-by: Sergei Dmitrouk --- OvmfPkg/VirtioFsDxe/SimpleFsOpen.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c index d73d23fe8665..9e46e8ab8385 100644 --- a/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c +++ b/OvmfPkg/VirtioFsDxe/SimpleFsOpen.c @@ -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. -- 2.17.6 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75047): https://edk2.groups.io/g/devel/message/75047 Mute This Topic: https://groups.io/mt/82760960/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-