Skip to contentSkip to conversation

Btrfs: fix max dir item size calculation

PATCH New Filipe David Borba Manana 1 participant 1 message Nov 27, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: fix max dir item size calculation

We were accounting for sizeof(struct btrfs_item) twice, once in the data_size variable and another time in the if statement below.

---
 fs/btrfs/dir-item.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/dir-item.c +1 -1
index c031ea3..9a89ceb 100644
@@ -261,7 +261,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
 	 * see if there is room in the item to insert this
 	 * name
 	 */
-	data_size = sizeof(*di) + name_len + sizeof(struct btrfs_item);
+	data_size = sizeof(*di) + name_len;
 	leaf = path->nodes[0];
 	slot = path->slots[0];
 	if (data_size + btrfs_item_size_nr(leaf, slot) +
Signature · 1 line
1.7.9.5