From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web10.4431.1620773793572967732 for ; Tue, 11 May 2021 15:56:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.net header.s=2017 header.b=EvUwICWU; spf=pass (domain: posteo.net, ip: 185.67.36.66, mailfrom: sergei@posteo.net) Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 5C4812400FC for ; Wed, 12 May 2021 00:56:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1620773791; bh=nc4pGKS5CkQwZCZLA/rjYDlACFyK0tByOwfVQ3sMqig=; h=From:To:Cc:Subject:Date:From; b=EvUwICWUS1aHyWa0Q28ZjzkUchfNzIeeJN2EFzKoLxoO56bVVUdzsYK/UEqVWAND5 hpkEFjUQ9L7Fi2t1ljBS179xnJCoUULTxY3BqqzUakMSMdpZr6BzyGpn5T4QxDo/Oa PJeKvIGMFNyWnkdsjHJ9AZbKNk4uTS6Qq/ppjqojHQQUGs9aQEuQhGqfoxXeltMki4 GVkyo4YLYkh/N9DYhjzj5vVjLswIQjq9Yc3CKz2NqLZ3owdhq5BoyX2cQfMtQWwQGI mmOBTpvVC7cO0MzgtyymoXUE/CffgyhizNbM9Rzj2h+vj9U6/IJVEQ5NsWv+s2KoPv VTYp6W6YWS4QA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FftZk2mgJz9rxK; Wed, 12 May 2021 00:56:30 +0200 (CEST) From: "Sergei Dmitrouk" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ard Biesheuvel , Jordan Justen Subject: [PATCH v1 2/2] OvmfPkg/VirtioFsDxe: suppress incorrect gcc warnings Date: Tue, 11 May 2021 22:56:16 +0000 Message-Id: <20210511225616.5942-3-sergei@posteo.net> In-Reply-To: <20210511225616.5942-1-sergei@posteo.net> References: <20210511225616.5942-1-sergei@posteo.net> `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