shithub: lwext4

Download patch

ref: 622abd1c2f93e197eec080603b35a6aa48a6bebe
parent: d9dec8dc9f60f42149ca5d55c0de7c8a2d37fc06
author: ngkaho1234 <[email protected]>
date: Sun Nov 1 09:11:35 EST 2015

ext4_fs_inode_checksum: fix checksum calculation

If inode size is not large enough to hold 32bit checksum,
then return lower 16bit.

--- a/lwext4/ext4_fs.c
+++ b/lwext4/ext4_fs.c
@@ -700,6 +700,12 @@
 				inode_size);
 		ext4_inode_set_checksum(sb, inode_ref->inode,
 				orig_checksum);
+
+		/* If inode size is not large enough to hold the
+		 * upper 16bit of the checksum */
+		if (inode_size == EXT4_GOOD_OLD_INODE_SIZE)
+			checksum &= 0xFFFF;
+
 	}
 	return checksum;
 }