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>
This commit is contained in:
parent
9e0dd182b4
commit
92576929fb
|
@ -1080,9 +1080,12 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
|
||||||
key.offset = *start;
|
key.offset = *start;
|
||||||
dev_offset = *start;
|
dev_offset = *start;
|
||||||
} else {
|
} else {
|
||||||
|
u64 tmp;
|
||||||
|
|
||||||
ret = find_next_chunk(chunk_root,
|
ret = find_next_chunk(chunk_root,
|
||||||
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
|
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
|
||||||
&key.offset);
|
&tmp);
|
||||||
|
key.offset = tmp;
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue