mirror of https://github.com/xemu-project/xemu.git
Revert "savevm: fix corruption in vmstate_subsection_load()."
This reverts commit eb60260de0
.
Conflicts:
savevm.c
We changed qemu_peek_byte() prototype, just fixed the rejects.
Signed-off-by: Juan Quintela<quintela@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
c63807244f
commit
3da9eebda9
10
savevm.c
10
savevm.c
|
@ -1704,12 +1704,6 @@ static const VMStateDescription *vmstate_get_subsection(const VMStateSubsection
|
||||||
static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
const VMStateSubsection *sub = vmsd->subsections;
|
|
||||||
|
|
||||||
if (!sub || !sub->needed) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
|
while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {
|
||||||
char idstr[256];
|
char idstr[256];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1731,7 +1725,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
||||||
/* it don't have a valid subsection name */
|
/* it don't have a valid subsection name */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
sub_vmsd = vmstate_get_subsection(sub, idstr);
|
sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);
|
||||||
if (sub_vmsd == NULL) {
|
if (sub_vmsd == NULL) {
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
@ -1740,7 +1734,6 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,
|
||||||
qemu_file_skip(f, len); /* idstr */
|
qemu_file_skip(f, len); /* idstr */
|
||||||
version_id = qemu_get_be32(f);
|
version_id = qemu_get_be32(f);
|
||||||
|
|
||||||
assert(!sub_vmsd->subsections);
|
|
||||||
ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);
|
ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1764,7 +1757,6 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
|
||||||
qemu_put_byte(f, len);
|
qemu_put_byte(f, len);
|
||||||
qemu_put_buffer(f, (uint8_t *)vmsd->name, len);
|
qemu_put_buffer(f, (uint8_t *)vmsd->name, len);
|
||||||
qemu_put_be32(f, vmsd->version_id);
|
qemu_put_be32(f, vmsd->version_id);
|
||||||
assert(!vmsd->subsections);
|
|
||||||
vmstate_save_state(f, vmsd, opaque);
|
vmstate_save_state(f, vmsd, opaque);
|
||||||
}
|
}
|
||||||
sub++;
|
sub++;
|
||||||
|
|
Loading…
Reference in New Issue