From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web08.6475.1620984549824270988 for ; Fri, 14 May 2021 02:29:10 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UzkPDk1N; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620984548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U6F2vNGo0nFNfUh9AtExEX/j5Od7HjmV0EsfUf0iFdw=; b=UzkPDk1Nlrs0RapmCbglF0Sebpwe4HaM6omiUIN3FvN7x4ZvTVOoSG6ka7XAjze2trrwEK et6btjVUB7zaZXbVNbCbdvRl+rPvflRefrWOU7e21drnCZMw576pt/ujV9laPGxJO+I7Bj 1eQYrB2aWLjNaayeVB+ZdogaYPJ/Pf0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-7nXsidAONSKxh5MitvLmoA-1; Fri, 14 May 2021 05:29:05 -0400 X-MC-Unique: 7nXsidAONSKxh5MitvLmoA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBB046D241; Fri, 14 May 2021 09:29:03 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-190.ams2.redhat.com [10.36.112.190]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0E5519C59; Fri, 14 May 2021 09:29:02 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v1 2/2] OvmfPkg/VirtioFsDxe: suppress incorrect gcc warnings To: devel@edk2.groups.io, sergei@posteo.net Cc: Ard Biesheuvel , Jordan Justen References: <20210511225616.5942-1-sergei@posteo.net> <20210511225616.5942-3-sergei@posteo.net> From: "Laszlo Ersek" Message-ID: <1137711f-ef3a-5421-9892-56e13b6c8b6b@redhat.com> Date: Fri, 14 May 2021 11:29:01 +0200 MIME-Version: 1.0 In-Reply-To: <20210511225616.5942-3-sergei@posteo.net> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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