[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/12] savevm: Live migration handlers register
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH 02/12] savevm: Live migration handlers register the struct directly |
Date: |
Fri, 29 Jun 2012 13:49:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) |
Igor Mitsyanko <address@hidden> wrote:
> On 06/28/2012 11:22 PM, Juan Quintela wrote:
>> Notice that the live migration users never unregister, so no problem
>> about freeing the ops structure.
>>
>> Signed-off-by: Juan Quintela <address@hidden>
>> ---
>> arch_init.c | 9 +++++++--
>> block-migration.c | 10 ++++++++--
>> migration.h | 4 ++--
>> savevm.c | 18 +++++++-----------
>> vl.c | 3 +--
>> vmstate.h | 5 +----
>> 6 files changed, 26 insertions(+), 23 deletions(-)
>>
>> @@ -1234,16 +1231,12 @@ int register_savevm_live(DeviceState *dev,
>> se = g_malloc0(sizeof(SaveStateEntry));
>> se->version_id = version_id;
>> se->section_id = global_section_id++;
>> - se->ops = g_malloc0(sizeof(SaveVMHandlers));
>> - se->ops->set_params = set_params;
>> - se->ops->save_live_state = save_live_state;
>> - se->ops->save_state = save_state;
>> - se->ops->load_state = load_state;
>> + se->ops = ops;
>> se->opaque = opaque;
>> se->vmsd = NULL;
>> se->no_migrate = 0;
>> /* if this is a live_savem then set is_ram */
>> - if (save_live_state != NULL) {
>> + if (ops->save_live_state != NULL) {
>
> Maybe add assert on ops==NULL before dereferencing it here?
I audited all callers. See that I create the ops before calling it. If
ops is NULL, we have big problems, so no problem to crash there.
Later, Juan.
- [Qemu-devel] [PATCH 00/12] Split ram_save_live() function, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 01/12] savevm: Use a struct to pass all handlers, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 02/12] savevm: Live migration handlers register the struct directly, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 03/12] savevm: remove SaveSetParamsHandler, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 04/12] savevm: remove SaveLiveStateHandler, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 05/12] savevm: Refactor cancel operation in its own operation, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 06/12] savevm: introduce is_active method, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 09/12] ram: save_live_setup() don't need to sent pages, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 08/12] savevm: split save_live into stage2 and stage3, Juan Quintela, 2012/06/28
- [Qemu-devel] [PATCH 10/12] ram: save_live_complete() only do one loop, Juan Quintela, 2012/06/28