diff options
author | Ivan Jager <aij+@mrph.org> | 2014-01-17 15:00:43 +0100 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-01-31 08:22:29 -0800 |
commit | 0511ca4b502f1cbdd5e92c287d97c8356cdaff66 (patch) | |
tree | 0896447a6c31d9bd0a796c5501f59a9781cddc57 /man/Makefile | |
parent | ef3f6124f0b5e8be126999f27f7f299a6bb3fbf6 (diff) |
btrfs-progs: Fix bus error on sparc
Currently, as of 8cae1840afb3ea44dcc298f32983e577480dfee4 when running
btrfs-convert I get a bus error.
The problem is that struct btrfs_key has __attribute__ ((__packed__))
so it is not aligned. Then, a pointer to it's objectid field is taken,
cast to a void*, then eventually cast back to a u64* and
dereferenced. The problem is that the dereferenced u64* is not
necessarily aligned (ie, not necessarily a valid u64*), resulting in
undefined behavior.
This patch adds a local u64 variable which would of course be properly
aligned and then uses a pointer to that.
I did not modify the call from btrfs_fs_roots_compare_roots as that
uses struct btrfs_root which is a regular struct and would thus have
it's members correctly aligned to begin with.
After patching this I realized Liu Bo had already written a similar
patch, but I think mine is cleaner, so I'm sending it anyway.
Signed-off-by: Ivan Jager <aij+@mrph.org>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'man/Makefile')
0 files changed, 0 insertions, 0 deletions