]> Git Repo - qemu.git/commit
block/vhdx: Don't take address of fields in packed structs
authorPeter Maydell <[email protected]>
Tue, 16 Oct 2018 17:09:38 +0000 (18:09 +0100)
committerKevin Wolf <[email protected]>
Mon, 5 Nov 2018 14:09:54 +0000 (15:09 +0100)
commit1229e46d3cfe61ee0b11f08fbbc7530af1578637
treeb28c252d9bb6bd1715cc3f7be68f275d792b5ad3
parentc317b646d752e97f64e97ba2145d8dfc55589c92
block/vhdx: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/vhdx-endian.c
block/vhdx-log.c
block/vhdx.c
block/vhdx.h
This page took 0.025617 seconds and 4 git commands to generate.