From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 104802095BB74 for ; Tue, 12 Sep 2017 23:32:19 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2017 23:35:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,386,1500966000"; d="scan'208";a="150737345" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 12 Sep 2017 23:35:16 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 23:35:16 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 12 Sep 2017 23:35:16 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.39]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.219]) with mapi id 14.03.0319.002; Wed, 13 Sep 2017 14:35:13 +0800 From: "Zeng, Star" To: Laszlo Ersek , edk2-devel-01 CC: Ard Biesheuvel , "Dong, Eric" , Paulo Alcantara , "Ni, Ruiyu" , "Zeng, Star" Thread-Topic: [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in ICB.Flags[2:0] Thread-Index: AQHTLBYuANhx6L68i0CvyLS0VLp7F6KyXKIA Date: Wed, 13 Sep 2017 06:35:12 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9409B3@shsmsx102.ccr.corp.intel.com> References: <20170912222612.14451-1-lersek@redhat.com> <20170912222612.14451-2-lersek@redhat.com> In-Reply-To: <20170912222612.14451-2-lersek@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Wed, 13 Sep 2017 06:32:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com]=20 Sent: Wednesday, September 13, 2017 6:26 AM To: edk2-devel-01 Cc: Ard Biesheuvel ; Dong, Eric ; Paulo Alcantara ; Ni, Ruiyu ; = Zeng, Star Subject: [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in ICB.Fla= gs[2:0] 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 --- 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