From 73043664dc8a48d329881632d33dd9eae6bd060a Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 14 Aug 2013 16:16:39 -0700 Subject: btrfs-progs: fix in-place byte swapping Storing fixed-endian values in native cpu types defeats the purpose of using sparse endian types to find endian conversion bugs. Signed-off-by: Zach Brown Signed-off-by: David Sterba Signed-off-by: Chris Mason --- uuid-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'uuid-tree.c') diff --git a/uuid-tree.c b/uuid-tree.c index 3a4c48e4..39c3f3fd 100644 --- a/uuid-tree.c +++ b/uuid-tree.c @@ -43,6 +43,7 @@ static int btrfs_uuid_tree_lookup_any(int fd, const u8 *uuid, u8 type, struct btrfs_ioctl_search_args search_arg; struct btrfs_ioctl_search_header *search_header; u32 item_size; + __le64 lesubid; btrfs_uuid_to_key(uuid, &key_objectid, &key_offset); @@ -82,8 +83,8 @@ static int btrfs_uuid_tree_lookup_any(int fd, const u8 *uuid, u8 type, } /* return first stored id */ - memcpy(subid, search_header + 1, sizeof(*subid)); - *subid = le64_to_cpu(*subid); + memcpy(&lesubid, search_header + 1, sizeof(lesubid)); + *subid = le64_to_cpu(lesubid); out: return ret; -- cgit v1.2.3