summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-11-04 15:11:54 +0100
committerDavid Sterba <dsterba@suse.com>2016-11-09 13:47:34 +0100
commit92576929fbbeb3c41abba9a4a217a6c69d546c7e (patch)
tree4226f93d7a0326b164a1a906415c6d4ca66e2965 /volumes.c
parent9e0dd182b4fb8ca87c47c256c25a43b6505cc45b (diff)
btrfs-progs: fix unaligned u64 access in btrfs_alloc_data_chunk
The key.offset member is not well-aligned as the key is packed, use a temporary variable to pass the argument. Reported by ASAN in misc test 002. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/volumes.c b/volumes.c
index 70d8940..c128472 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1080,9 +1080,12 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
key.offset = *start;
dev_offset = *start;
} else {
+ u64 tmp;
+
ret = find_next_chunk(chunk_root,
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
- &key.offset);
+ &tmp);
+ key.offset = tmp;
if (ret)
return ret;
}