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 <ard.biesheuvel@linaro.org>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/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 = 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 = EFI_UNSUPPORTED;
+ break;
}
Done:
--
2.14.1.3.gb7cf6e02401b
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Thanks/Ray > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, September 13, 2017 6:26 AM > To: edk2-devel-01 <edk2-devel@lists.01.org> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Dong, Eric > <eric.dong@intel.com>; Paulo Alcantara <pcacjr@zytor.com>; Ni, Ruiyu > <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com> > Subject: [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in > ICB.Flags[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 <ard.biesheuvel@linaro.org> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Paulo Alcantara <pcacjr@zytor.com> > Cc: Ruiyu Ni <ruiyu.ni@intel.com> > Cc: Star Zeng <star.zeng@intel.com> > Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Reported-by: Gerd Hoffmann <kraxel@redhat.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek <lersek@redhat.com> > --- > MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 8 > ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c > b/MdeModulePkg/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 = 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 = EFI_UNSUPPORTED; > + break; > } > > Done: > -- > 2.14.1.3.gb7cf6e02401b > _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Star Zeng <star.zeng@intel.com> -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com] Sent: Wednesday, September 13, 2017 6:26 AM To: edk2-devel-01 <edk2-devel@lists.01.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Dong, Eric <eric.dong@intel.com>; Paulo Alcantara <pcacjr@zytor.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Zeng, Star <star.zeng@intel.com> Subject: [PATCH 1/2] MdeModulePkg/UdfDxe: reject reserved values in ICB.Flags[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 <ard.biesheuvel@linaro.org> Cc: Eric Dong <eric.dong@intel.com> Cc: Paulo Alcantara <pcacjr@zytor.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reported-by: Gerd Hoffmann <kraxel@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/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 = 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 = EFI_UNSUPPORTED; + break; } Done: -- 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.