Skip to content

Commit

Permalink
migration: Correctly handle subsections with no 'needed' function
Browse files Browse the repository at this point in the history
Currently the vmstate subsection handling code treats a subsection
with no 'needed' function pointer as if it were the subsection
list terminator, so the subsection is never transferred and nor
is any subsection following it in the list.

Handle NULL 'needed' function pointers in subsections in the same
way that we do for top level VMStateDescription structures:
treat the subsection as always being needed.

This doesn't change behaviour for the current set of devices
in the tree, because all subsections declare a 'needed' function.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
  • Loading branch information
pm215 authored and Juan Quintela committed Aug 22, 2018
1 parent be1d2c4 commit 6f4923f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions migration/vmstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
static const VMStateDescription *
vmstate_get_subsection(const VMStateDescription **sub, char *idstr)
{
while (sub && *sub && (*sub)->needed) {
while (sub && *sub) {
if (strcmp(idstr, (*sub)->name) == 0) {
return *sub;
}
Expand Down Expand Up @@ -486,8 +486,8 @@ static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
int ret = 0;

trace_vmstate_subsection_save_top(vmsd->name);
while (sub && *sub && (*sub)->needed) {
if ((*sub)->needed(opaque)) {
while (sub && *sub) {
if (vmstate_save_needed(*sub, opaque)) {
const VMStateDescription *vmsdsub = *sub;
uint8_t len;

Expand Down

0 comments on commit 6f4923f

Please sign in to comment.