From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Walle Date: Tue, 16 Aug 2016 13:41:21 +0200 Subject: [U-Boot] [RFC PATCH 3/4] ext4: fix endianess problems in ext4 write support In-Reply-To: <2198104.q3j2TPqOcn@pebbles.site> References: <1471007781-23656-1-git-send-email-michael@walle.cc> <1471007781-23656-3-git-send-email-michael@walle.cc> <2198104.q3j2TPqOcn@pebbles.site> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Stefan, Am 2016-08-14 03:50, schrieb Stefan Bruens: > On Freitag, 12. August 2016 15:16:20 CEST Michael Walle wrote: >> All fields were accessed directly instead of using the proper byte >> swap >> functions. Thus, ext4 write support was only usable on little-endian >> architectures. Fix this. >> >> Signed-off-by: Michael Walle > > I have tested this on sandbox (x86_64), no regressions found. Some > remarks > below. > > Reviewed-by: Stefan Br?ns > Tested-by: Stefan Br?ns > [snip] >> @@ -2234,7 +2246,7 @@ int ext4fs_mount(unsigned part_length) >> * and we do not support metadata_csum (and cannot reliably find >> * files when it is set. Refuse to mount. >> */ >> - if (data->sblock.feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) { >> + if (le32_to_cpu(data->sblock.feature_incompat) & >> EXT4_FEATURE_INCOMPAT_64BIT) { printf("Unsupported feature found >> (64bit, >> possibly metadata_csum), not mounting\n"); goto fail; >> } > > This should have a if ((data->sblock.revision_level !=0) && ... in > front, > features are not defined for revision 0. Applies to other places as > well ... > are you sure about that? I can't find any code in the kernel where features are only valid if revision > 0. Also, I couldn't find anything in the ext4 documentation wiki: https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout -michael