qemu-devel
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]