ref: 8eff9f9971a1056ade031e646acb9b07a972fd65
parent: 18ddc30b89ea8ced586e8ff8c09c46613f1a397c
author: Kaho Ng <ngkaho1234@gmail.com>
date: Wed May 11 20:24:02 EDT 2016
ext4_xattr: endianness fix.
--- a/src/ext4_xattr.c
+++ b/src/ext4_xattr.c
@@ -597,9 +597,9 @@
entry->e_name_len = (uint8_t)item->name_len;
entry->e_name_index = item->name_index;
entry->e_value_offs =
- (char *)ibody_data_ptr - (char *)EXT4_XATTR_IFIRST(ibody_header);
+ to_le16((char *)ibody_data_ptr - (char *)EXT4_XATTR_IFIRST(ibody_header));
entry->e_value_block = 0;
- entry->e_value_size = item->data_size;
+ entry->e_value_size = to_le32(item->data_size);
}
static void ext4_xattr_set_block_entry(struct ext4_xattr_item *item,
@@ -610,9 +610,9 @@
block_entry->e_name_len = (uint8_t)item->name_len;
block_entry->e_name_index = item->name_index;
block_entry->e_value_offs =
- (char *)block_data_ptr - (char *)block_header;
+ to_le16((char *)block_data_ptr - (char *)block_header);
block_entry->e_value_block = 0;
- block_entry->e_value_size = item->data_size;
+ block_entry->e_value_size = to_le32(item->data_size);
}
static int ext4_xattr_write_to_disk(struct ext4_xattr_ref *xattr_ref)