From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web11.98979.1674813749456736456 for ; Fri, 27 Jan 2023 02:02:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=Rrqvvdk1; spf=pass (domain: posteo.de, ip: 185.67.36.66, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9D5962401B6 for ; Fri, 27 Jan 2023 11:02:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1674813747; bh=oofz4fuM44CDXJCFYP81lKpwhICLKB1vVdj0JpvVZeo=; h=Subject:From:Date:Cc:To:From; b=Rrqvvdk1KwXRSJkyGnh8DdPhst7omYrurWPL9j7uFl4tfsyNdgcAdRfZFLIpR/5h5 vhNym4JoLPGgldqH6ZP7dgQ7KAnWSNWm+po2e+0hizcXRLmpfKmxodpSr3N3hHbYGP OwxBeiOkdAp0jFNvl6ot1JCDFTOoolFwif1OBNokfyeI25lyUrJFJ8MTLyZRsiobAZ qCTiShgbX4Li1VCL2ZYUQY228//z1d/hvIG1iNvG08zCtBxE38RD3Zu+4tspbZcFVo /eGhFJGZMkbGKhuqFeIzERCVsrVI+Ijs6Ih/nxr9i40peK0u8bAzy1pS1/V6irbChd xmUSZkF7BzgxQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P3Cmf3HBFz9rxP; Fri, 27 Jan 2023 11:02:26 +0100 (CET) Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [edk2-platforms][PATCH v3 02/11] Ext4Pkg: Fix incorrect checksum metadata feature check From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= In-Reply-To: <20230127092945.94389-3-savvamtr@gmail.com> Date: Fri, 27 Jan 2023 10:02:16 +0000 Cc: edk2-devel-groups-io , Pedro Falcato , Vitaly Cheptsov Message-Id: <72C59A93-6B86-4046-A408-6D63396C24B2@posteo.de> References: <20230127092945.94389-1-savvamtr@gmail.com> <20230127092945.94389-3-savvamtr@gmail.com> To: Savva Mitrofanov Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 27. Jan 2023, at 10:29, Savva Mitrofanov wrote: >=20 > Missing comparison !=3D 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 !=3D 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 >=20 > Cc: Marvin H=C3=A4user > Cc: Pedro Falcato > Cc: Vitaly Cheptsov > Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.") > Signed-off-by: Savva Mitrofanov > --- > Features/Ext4Pkg/Ext4Dxe/Superblock.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > 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 ( > } >=20 > // At the time of writing, it's the only supported checksum. > - if (Partition->FeaturesCompat & = EXT4_FEATURE_RO_COMPAT_METADATA_CSUM && > - (Sb->s_checksum_type !=3D EXT4_CHECKSUM_CRC32C)) > - { > + if (EXT4_HAS_METADATA_CSUM (Partition) && (Sb->s_checksum_type !=3D = EXT4_CHECKSUM_CRC32C)) { > return EFI_UNSUPPORTED; > } >=20 > - if ((Partition->FeaturesIncompat & EXT4_FEATURE_INCOMPAT_CSUM_SEED) = !=3D 0) { > + if (EXT4_HAS_INCOMPAT (Partition, EXT4_FEATURE_INCOMPAT_CSUM_SEED)) = { > Partition->InitialSeed =3D Sb->s_checksum_seed; > } else { > Partition->InitialSeed =3D Ext4CalculateChecksum (Partition, = Sb->s_uuid, 16, ~0U); > --=20 > 2.39.0 >=20