Igor Mitsyanko <[email protected]> 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 <[email protected]>
>> ---
>> 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.