Skip to contentSkip to conversation

fsck: Fix big endian platforms

PATCH In review Rosen Penev 2 participants 2 messages Dec 8, 2018 – Dec 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck: Fix big endian platforms

Since "fsck.f2fs: integrate sanity_check_inode to __check_inode_mode", big endian platforms have been broken due to an endianness bug.

More info: https://github.com/openwrt/openwrt/pull/1575

---
 fsck/fsck.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fsck/fsck.c +2 -2
index 366ba13..73901d1 100644
@@ -339,7 +339,7 @@ out:
 	return ret;
 }
 
-static int __check_inode_mode(u32 nid, enum FILE_TYPE ftype, u32 mode)
+static int __check_inode_mode(u32 nid, enum FILE_TYPE ftype, u16 mode)
 {
 	if (ftype >= F2FS_FT_MAX)
 		return 0;
@@ -457,7 +457,7 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,
 		return 0;
 
 	if (ntype == TYPE_INODE &&
-		__check_inode_mode(nid, ftype, le32_to_cpu(node_blk->i.i_mode)))
+		__check_inode_mode(nid, ftype, le16_to_cpu(node_blk->i.i_mode)))
 		return -EINVAL;
 
 	/* workaround to fix later */
Signature · 1 line
2.19.2