summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2015-04-06 19:41:07 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-06 19:41:07 +0000
commit0a726d107744add5ea656bca6b214ba3c8100ee6 (patch)
tree73604185b90b7ef5ccb1c1d061f55b07af2f4cea
parent0f68c105ffaf80b9619b8970572b213d284ce117 (diff)
parent9036d55be0a9bccf6721b64ba0d116d7afd66201 (diff)
downloadextras-0a726d107744add5ea656bca6b214ba3c8100ee6.tar.gz
Merge "ext_utils: xattr_free_space assert"
-rw-r--r--ext4_utils/contents.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index e4e38814..8b2b0fd0 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -267,6 +267,7 @@ int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime)
*/
static size_t xattr_free_space(struct ext4_xattr_entry *entry, char *end)
{
+ end -= sizeof(uint32_t); /* Required four null bytes */
while(!IS_LAST_ENTRY(entry) && (((char *) entry) < end)) {
end -= EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size));
entry = EXT4_XATTR_NEXT(entry);
@@ -277,7 +278,7 @@ static size_t xattr_free_space(struct ext4_xattr_entry *entry, char *end)
return 0;
}
- return (end - ((char *) entry)) - sizeof(uint32_t);
+ return end - ((char *) entry);
}
/*