diff options
| author | ngkaho1234 <ngkaho1234@gmail.com> | 2015-11-01 14:11:35 +0000 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2015-11-01 15:27:24 +0100 |
| commit | 622abd1c2f93e197eec080603b35a6aa48a6bebe (patch) | |
| tree | a1c0630d9ff6924e74937d48fd7452dc40f97b21 | |
| parent | d9dec8dc9f60f42149ca5d55c0de7c8a2d37fc06 (diff) | |
ext4_fs_inode_checksum: fix checksum calculation
If inode size is not large enough to hold 32bit checksum,
then return lower 16bit.
| -rw-r--r-- | lwext4/ext4_fs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lwext4/ext4_fs.c b/lwext4/ext4_fs.c index 3cbce8f..c1bc25f 100644 --- a/lwext4/ext4_fs.c +++ b/lwext4/ext4_fs.c @@ -700,6 +700,12 @@ static uint32_t ext4_fs_inode_checksum(struct ext4_inode_ref *inode_ref) 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; } |
