From: David Sterba Date: Fri, 4 Nov 2016 14:11:54 +0000 (+0100) Subject: btrfs-progs: fix unaligned u64 access in btrfs_alloc_data_chunk X-Git-Tag: upstream/4.16.1~1039 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92576929fbbeb3c41abba9a4a217a6c69d546c7e;p=platform%2Fupstream%2Fbtrfs-progs.git 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 --- 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; }