Skip to contentSkip to conversation

btrfs: missing endianess conversion in insert_new_root

PATCH New Christoph Hellwig 1 participant 1 message Sep 3, 2008 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: missing endianess conversion in insert_new_root

Add two missing endianess conversions in this function, found by sparse.

(Btw, there are a _lot_ more endianess warnings, but they're old hidden
in the obsfucated macros from hell mess. I'll try to detangle and fix it when I get some time)

ctree.c +5 -4
Index: btrfs-unstable/ctree.c
===================================================================
@@ -1653,8 +1653,8 @@ static int noinline insert_new_root(stru
 
 	c = btrfs_alloc_free_block(trans, root, root->nodesize,
 				   root->root_key.objectid,
-				   root_gen, lower_key.objectid, level,
-				   root->node->start, 0);
+				   root_gen, le64_to_cpu(lower_key.objectid),
+				   level, root->node->start, 0);
 	if (IS_ERR(c))
 		return PTR_ERR(c);
 
@@ -2345,8 +2345,9 @@ again:
 
 	right = btrfs_alloc_free_block(trans, root, root->leafsize,
 					 root->root_key.objectid,
-					 root_gen, disk_key.objectid, 0,
-					 l->start, 0);
+					 root_gen,
+					 le64_to_cpu(disk_key.objectid),
+					 0, l->start, 0);
 	if (IS_ERR(right)) {
 		BUG_ON(1);
 		return PTR_ERR(right);