summary refs log tree commit diff stats
path: root/qemu-bridge-helper.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-07-26 15:40:28 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-07-26 16:17:56 +0100
commit0c413ba0d87c1c0444b5aaec050ba86f33409474 (patch)
treebb70eb013b09d26978f24405971ed242a7c7d5fc /qemu-bridge-helper.c
parent372e458ebc41c980d4fa23e3234a5222813cd405 (diff)
downloadfocaccia-qemu-0c413ba0d87c1c0444b5aaec050ba86f33409474.tar.gz
focaccia-qemu-0c413ba0d87c1c0444b5aaec050ba86f33409474.zip
vmstate.h: Type check VMSTATE_STRUCT_VARRAY macros
The VMSTATE_STRUCT_VARRAY_UINT32 macro is intended to handle
migrating a field which is an array of structs, but where instead of
migrating the entire array we only migrate a variable number of
elements of it.

The VMSTATE_STRUCT_VARRAY_POINTER_UINT32 macro is intended to handle
migrating a field which is of pointer type, and points to a
dynamically allocated array of structs of variable size.

We weren't actually checking that the field passed to
VMSTATE_STRUCT_VARRAY_UINT32 really is an array, with the result that
accidentally using it where the _POINTER_ macro was intended would
compile but silently corrupt memory on migration.

Add type-checking that enforces that the field passed in is
really of the right array type. This applies to all the VMSTATE
macros which use flags including VMS_VARRAY_* but not VMS_POINTER.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Tested-by: Damien Hedde <damien.hedde@greensocs.com>
Message-id: 20190725163710.11703-3-peter.maydell@linaro.org
Diffstat (limited to 'qemu-bridge-helper.c')
0 files changed, 0 insertions, 0 deletions