From nobody Sun Apr 28 13:44:19 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505255181086181.3613397833633; Tue, 12 Sep 2017 15:26:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D953B21D492CD; Tue, 12 Sep 2017 15:23:22 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5FCE021E87972 for ; Tue, 12 Sep 2017 15:23:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FC5F67722; Tue, 12 Sep 2017 22:26:18 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-50.rdu2.redhat.com [10.10.120.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 876B717B43; Tue, 12 Sep 2017 22:26:16 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2FC5F67722 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 13 Sep 2017 00:26:11 +0200 Message-Id: <20170912222612.14451-2-lersek@redhat.com> In-Reply-To: <20170912222612.14451-1-lersek@redhat.com> References: <20170912222612.14451-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 12 Sep 2017 22:26:18 +0000 (UTC) Subject: [edk2] [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in ICB.Flags[2:0] X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Star Zeng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The ECMA-167 standard (3rd Edition, June 1997) reserves values 4 through 7 in the ICB.Flags[2:0] bit-field for future standardization; see "14.6 ICB Tag" / "14.6.8 Flags (RBP 18)". https://www.ecma-international.org/publications/standards/Ecma-167.htm The switch (RecordingFlags) statement in the ReadFile() function handles all the standard values, using the constants of the UDF_FE_RECORDING_FLAGS enum type. However, the reserved values are not caught with a "default" case label, which both breaks the edk2 Coding Style Spec, and leaves the Status variable un-initialized, before we return Status under the Done label. Set Status to EFI_UNSUPPORTED if we encounter a reserved value. This issue was reported by Ard's and Gerd's CI systems independently (through build failures with GCC48/GCC49, DEBUG/RELEASE targets). Cc: Ard Biesheuvel Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Reported-by: Ard Biesheuvel Reported-by: Gerd Hoffmann Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Paulo Alcantara Reviewed-by: Ruiyu Ni Reviewed-by: Star Zeng --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/Md= eModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 72862653738e..096fbb4452cb 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -1150,6 +1150,14 @@ ReadFile ( ASSERT (FALSE); Status =3D EFI_UNSUPPORTED; break; + + default: + // + // A flag value reserved by the ECMA-167 standard (3rd Edition - June + // 1997); 14.6 ICB Tag; 14.6.8 Flags (RBP 18); was found. + // + Status =3D EFI_UNSUPPORTED; + break; } =20 Done: --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun Apr 28 13:44:19 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505255183678952.3733646224612; Tue, 12 Sep 2017 15:26:23 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2435B21D492CB; Tue, 12 Sep 2017 15:23:25 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5BD6E21E87972 for ; Tue, 12 Sep 2017 15:23:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2E0D3C0587E3; Tue, 12 Sep 2017 22:26:20 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-50.rdu2.redhat.com [10.10.120.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A91C17B46; Tue, 12 Sep 2017 22:26:18 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2E0D3C0587E3 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 13 Sep 2017 00:26:12 +0200 Message-Id: <20170912222612.14451-3-lersek@redhat.com> In-Reply-To: <20170912222612.14451-1-lersek@redhat.com> References: <20170912222612.14451-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 12 Sep 2017 22:26:20 +0000 (UTC) Subject: [edk2] [PATCH 2/2] MdeModulePkg/UdfDxe: suppress incorrect compiler warning in ReadFile() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni , Eric Dong , Star Zeng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When building the driver for DEBUG/RELEASE, GCC48/GCC49 warn about ReadFile() possibly using "BytesLeft" without initializing it first. This is not the case. The reads of "BytesLeft" are only reachable if (ReadFileInfo->Flags =3D=3D READ_FILE_SEEK_AND_READ). But, in that case, we also set "BytesLeft" to "ReadFileInfo->FileDataSize", near the top of the function. Assign "BytesLeft" zero at the top, and add a comment that conforms to the pending Coding Style Spec feature request at . This issue was reported by Ard's and Gerd's CI systems independently. Cc: Ard Biesheuvel Cc: Eric Dong Cc: Paulo Alcantara Cc: Ruiyu Ni Cc: Star Zeng Reported-by: Ard Biesheuvel Reported-by: Gerd Hoffmann Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Paulo Alcantara Reviewed-by: Star Zeng --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/Md= eModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c index 096fbb4452cb..392494b2eb3f 100644 --- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c +++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c @@ -893,6 +893,11 @@ ReadFile ( LogicalBlockSize =3D LV_BLOCK_SIZE (Volume, UDF_DEFAULT_LV_NUM); DoFreeAed =3D FALSE; =20 + // + // set BytesLeft to suppress incorrect compiler/analyzer warnings + // + BytesLeft =3D 0; + switch (ReadFileInfo->Flags) { case READ_FILE_GET_FILESIZE: case READ_FILE_ALLOCATE_AND_READ: --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel