[PATCH 32/37] libext2fs: Extend inode checksum to cover the EA block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that e2fsprogs knows to read the entire s_inode_size, change the inode
checksum code to checksum the entire block.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 lib/ext2fs/csum.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)


diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
index 4fe4b3d..dc87de3 100644
--- a/lib/ext2fs/csum.c
+++ b/lib/ext2fs/csum.c
@@ -478,14 +478,9 @@ __u32 ext2fs_inode_csum(ext2_filsys fs, ext2_ino_t inum,
 {
 	struct ext2_inode_large *desc = inode;
 	int offset = offsetof(struct ext2_inode_large, i_checksum);
-	int extra_size = inode->i_extra_isize;
 	size_t size = fs->super->s_inode_size;
 	__u32 crc = 0;
 
-	if (size < EXT2_GOOD_OLD_INODE_SIZE + extra_size)
-		printf("ERROR: inode %d size %d != extra_size %d!\n", inum,
-		       size, extra_size + EXT2_GOOD_OLD_INODE_SIZE);
-
 	if (fs->super->s_creator_os != EXT2_OS_LINUX)
 		return 0;
 
@@ -508,8 +503,7 @@ __u32 ext2fs_inode_csum(ext2_filsys fs, ext2_ino_t inum,
 	crc = crc32c_le(crc, (char *)&inum, sizeof(inum));
 	crc = crc32c_le(crc, (char *)desc, offset);
 	offset += sizeof(inode->i_checksum); /* skip checksum */
-	crc = crc32c_le(crc, (char *)desc + offset,
-			   EXT2_GOOD_OLD_INODE_SIZE + extra_size - offset);
+	crc = crc32c_le(crc, (char *)desc + offset, size - offset);
 	return crc;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux