From 92576929fbbeb3c41abba9a4a217a6c69d546c7e Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 4 Nov 2016 15:11:54 +0100 Subject: 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 --- volumes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/volumes.c b/volumes.c index 70d89409..c128472d 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; } -- cgit v1.2.3