aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/hfsplus/xattr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index efc85b1377cc..3c6136f98c73 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -129,7 +129,7 @@ static int can_set_xattr(struct inode *inode, const char *name,
129 129
130static void hfsplus_init_header_node(struct inode *attr_file, 130static void hfsplus_init_header_node(struct inode *attr_file,
131 u32 clump_size, 131 u32 clump_size,
132 char *buf, size_t node_size) 132 char *buf, u16 node_size)
133{ 133{
134 struct hfs_bnode_desc *desc; 134 struct hfs_bnode_desc *desc;
135 struct hfs_btree_header_rec *head; 135 struct hfs_btree_header_rec *head;
@@ -139,8 +139,9 @@ static void hfsplus_init_header_node(struct inode *attr_file,
139 char *bmp; 139 char *bmp;
140 u32 used_nodes; 140 u32 used_nodes;
141 u32 used_bmp_bytes; 141 u32 used_bmp_bytes;
142 loff_t tmp;
142 143
143 hfs_dbg(ATTR_MOD, "init_hdr_attr_file: clump %u, node_size %zu\n", 144 hfs_dbg(ATTR_MOD, "init_hdr_attr_file: clump %u, node_size %u\n",
144 clump_size, node_size); 145 clump_size, node_size);
145 146
146 /* The end of the node contains list of record offsets */ 147 /* The end of the node contains list of record offsets */
@@ -154,7 +155,9 @@ static void hfsplus_init_header_node(struct inode *attr_file,
154 155
155 head = (struct hfs_btree_header_rec *)(buf + offset); 156 head = (struct hfs_btree_header_rec *)(buf + offset);
156 head->node_size = cpu_to_be16(node_size); 157 head->node_size = cpu_to_be16(node_size);
157 head->node_count = cpu_to_be32(i_size_read(attr_file) / node_size); 158 tmp = i_size_read(attr_file);
159 do_div(tmp, node_size);
160 head->node_count = cpu_to_be32(tmp);
158 head->free_nodes = cpu_to_be32(be32_to_cpu(head->node_count) - 1); 161 head->free_nodes = cpu_to_be32(be32_to_cpu(head->node_count) - 1);
159 head->clump_size = cpu_to_be32(clump_size); 162 head->clump_size = cpu_to_be32(clump_size);
160 head->attributes |= cpu_to_be32(HFS_TREE_BIGKEYS | HFS_TREE_VARIDXKEYS); 163 head->attributes |= cpu_to_be32(HFS_TREE_BIGKEYS | HFS_TREE_VARIDXKEYS);