On 27. Jan 2023, at 10:29, Savva Mitrofanov <savva...@gmail.com> wrote:
> 
> Missing comparison != 0 leads to broken logic condition.

The actual issue appears to be FeaturesCompat vs FeaturesRoCompat (latter is 
hidden by your usage of the macro). Checking for != 0 is redundant (albeit 
required by the code style guideline for non-functional reasons). Please 
confirm and update the commit message if you agree.

> Also replaced
> CSUM_SEED feature_incompat check with predefined macro EXT4_HAS_INCOMPAT
> 
> Cc: Marvin Häuser <mhaeu...@posteo.de>
> Cc: Pedro Falcato <pedro.falc...@gmail.com>
> Cc: Vitaly Cheptsov <vit9...@protonmail.com>
> Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.")
> Signed-off-by: Savva Mitrofanov <savva...@gmail.com>
> ---
> Features/Ext4Pkg/Ext4Dxe/Superblock.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c 
> b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
> index 5a3c7f478187..35dcf3c007c8 100644
> --- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c
> +++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
> @@ -220,13 +220,11 @@ Ext4OpenSuperblock (
>   }
> 
>   // At the time of writing, it's the only supported checksum.
> -  if (Partition->FeaturesCompat & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM &&
> -      (Sb->s_checksum_type != EXT4_CHECKSUM_CRC32C))
> -  {
> +  if (EXT4_HAS_METADATA_CSUM (Partition) && (Sb->s_checksum_type != 
> EXT4_CHECKSUM_CRC32C)) {
>     return EFI_UNSUPPORTED;
>   }
> 
> -  if ((Partition->FeaturesIncompat & EXT4_FEATURE_INCOMPAT_CSUM_SEED) != 0) {
> +  if (EXT4_HAS_INCOMPAT (Partition, EXT4_FEATURE_INCOMPAT_CSUM_SEED)) {
>     Partition->InitialSeed = Sb->s_checksum_seed;
>   } else {
>     Partition->InitialSeed = Ext4CalculateChecksum (Partition, Sb->s_uuid, 
> 16, ~0U);
> -- 
> 2.39.0
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99148): https://edk2.groups.io/g/devel/message/99148
Mute This Topic: https://groups.io/mt/96562691/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to