ref: 7bec846d340f30b82688e4fb1ca21e8d046fd233
parent: 6391e9bbdc491cae64f40bb16d7e5b0bf42df570
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sun Oct 25 17:39:03 EDT 2015
FIX: ext4_extent_full.c and ext4_extent.c lack endian conversion when doing checksum.
--- a/lwext4/ext4_extent.c
+++ b/lwext4/ext4_extent.c
@@ -163,7 +163,7 @@
struct ext4_extent_tail *tail;
tail = find_ext4_extent_tail(eh);
- tail->et_checksum = ext4_ext_block_csum(inode_ref, eh);
+ tail->et_checksum = to_le32(ext4_ext_block_csum(inode_ref, eh));
}
/**@brief Get physical block in the extent tree by logical block number.
--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -342,7 +342,7 @@
struct ext4_extent_tail *tail;
tail = find_ext4_extent_tail(eh);
- tail->et_checksum = ext4_ext_block_csum(inode_ref, eh);
+ tail->et_checksum = to_le32(ext4_ext_block_csum(inode_ref, eh));
}
static int ext4_ext_dirty(struct ext4_inode_ref *inode_ref,
@@ -409,7 +409,7 @@
}
tail = find_ext4_extent_tail(eh);
- if (tail->et_checksum != ext4_ext_block_csum(inode_ref, eh)) {
+ if (tail->et_checksum != to_le32(ext4_ext_block_csum(inode_ref, eh))) {
/* FIXME: Warning: extent checksum damaged? */
}