[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/13] migration: vmstate_register() check that instance_id is va
From: |
Juan Quintela |
Subject: |
[PATCH 08/13] migration: vmstate_register() check that instance_id is valid |
Date: |
Thu, 19 Oct 2023 21:08:26 +0200 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
include/migration/vmstate.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 9ca7e9cc48..d1282a78ef 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -28,6 +28,7 @@
#define QEMU_VMSTATE_H
#include "hw/vmstate-if.h"
+#include "qemu/error-report.h"
typedef struct VMStateInfo VMStateInfo;
typedef struct VMStateField VMStateField;
@@ -1226,6 +1227,11 @@ static inline int vmstate_register(VMStateIf *obj, int
instance_id,
const VMStateDescription *vmsd,
void *opaque)
{
+ if (instance_id == VMSTATE_INSTANCE_ID_ANY) {
+ error_report("vmstate_register: Invalid device: %s instance_id: %d",
+ vmsd->name, instance_id);
+ return -1;
+ }
return vmstate_register_with_alias_id(obj, instance_id, vmsd,
opaque, -1, 0, NULL);
}
--
2.41.0
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, (continued)
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Thomas Huth, 2023/10/20
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Juan Quintela, 2023/10/20
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Nicholas Piggin, 2023/10/20
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Juan Quintela, 2023/10/20
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Greg Kurz, 2023/10/20
- Re: [PATCH 07/13] RFC migration: icp/server is a mess, Nicholas Piggin, 2023/10/20
[PATCH 09/13] migration: Check in savevm_state_handler_insert for dups, Juan Quintela, 2023/10/19
[PATCH 10/13] migration: Improve example and documentation of vmstate_register(), Juan Quintela, 2023/10/19
[PATCH 08/13] migration: vmstate_register() check that instance_id is valid,
Juan Quintela <=
[PATCH 11/13] migration: Use vmstate_register_any() for audio, Juan Quintela, 2023/10/19
[PATCH 13/13] migration: Use vmstate_register_any() for vmware_vga, Juan Quintela, 2023/10/19
[PATCH 12/13] migration: Use vmstate_register_any() for eeprom93xx, Juan Quintela, 2023/10/19