qemu/include/migration
Peter Maydell 0c413ba0d8 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
2019-07-26 16:17:56 +01:00
..
blocker.h migration: Create migration/blocker.h 2017-05-17 12:04:59 +02:00
colo.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
cpu.h migration: Add VMSTATE_UINTTL_2DARRAY() 2017-05-04 09:39:01 +09:00
failover.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
global_state.h Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
misc.h migration/ram.c: add the free page optimization enable flag 2019-03-06 10:49:18 +00:00
qemu-file-types.h Clean up header guards that don't match their file name 2019-05-13 08:58:55 +02:00
register.h vmstate: constify SaveVMHandlers 2019-01-23 15:51:47 +00:00
snapshot.h migration: Create include for migration snapshots 2017-06-01 18:49:23 +02:00
vmstate.h vmstate.h: Type check VMSTATE_STRUCT_VARRAY macros 2019-07-26 16:17:56 +01:00