hmp pull 2017-10-30

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZ94j1AAoJEAUWMx68W/3ngqQQAKr2OM3tKJ0bLT2gJpGaeDAe
 xUtURizssA6hAe9FMGolMFLnZSYuo2ER+DdLjlbqEgpjGk3pKQgknQ/K7dloSg+f
 cchV/Qa+tQIREz023pAroEJgi6so0vBnCJvDAonPM08ZtXbIC4Tf0C9HLIuFQM0r
 7cP1qLq2hBDrp5B1lzlXn3KzYvLMoVNJU+PtcGpanHnLACrB1AqDnHU/5pDQ+7A1
 DLZR//TQGnZWt/FTs45q/LYb9YOLn2L79/TFqR6z9TwmOV49dAQAQOXUwz6gS6Gw
 oWnYRt3mDvK+mQiGMWfYTdEzrwHbgp+h+n5SXot9olYd7NqgYd7RST7FGZsb7ECI
 kEk0hXA+CTf2Qcmy9YZAZdb/IGJGP+zQtUQddtxbTJctqhJsvh4s6pWcW0Siq89e
 jXoWN80WhNvOaxCEwGM6i+W+dwEEyGK47/NiS89K7yYT98qzYeyTxgoSzR9a15bI
 U+4+C1lx2G7cb/I8Lix+7SO8/NR3eUxK+sCyN0XuWsWcxHcvBPNcsgcMODJgHbgV
 WqDTyWOtEZzgKuu/tyMNHs0EJ7tdlayH2trANx3W9c5Z1IUiCsah2ntFOT14hUbN
 Hgw9L5ULfj6/99LeH1pjDdk++Vb7iLbTCMXtHPli0n+HFZMULcnvZOqhBq+tDg6v
 9s8ity9yS6m0W3zyhyMf
 =nwyY
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20171030' into staging

hmp pull 2017-10-30

# gpg: Signature made Mon 30 Oct 2017 20:17:57 GMT
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20171030:
  monitor: fix dangling CPU pointer
  hmp: Replace error_report_err

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-10-31 11:18:00 +00:00
commit d2b9d71432
2 changed files with 26 additions and 23 deletions

26
hmp.c
View File

@ -670,7 +670,7 @@ void hmp_info_vnc(Monitor *mon, const QDict *qdict)
info2l = qmp_query_vnc_servers(&err);
if (err) {
error_report_err(err);
hmp_handle_error(mon, &err);
return;
}
if (!info2l) {
@ -785,7 +785,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
info = qmp_query_balloon(&err);
if (err) {
error_report_err(err);
hmp_handle_error(mon, &err);
return;
}
@ -1128,7 +1128,7 @@ void hmp_ringbuf_read(Monitor *mon, const QDict *qdict)
data = qmp_ringbuf_read(chardev, size, false, 0, &err);
if (err) {
error_report_err(err);
hmp_handle_error(mon, &err);
return;
}
@ -1195,9 +1195,7 @@ void hmp_balloon(Monitor *mon, const QDict *qdict)
Error *err = NULL;
qmp_balloon(value, &err);
if (err) {
error_report_err(err);
}
hmp_handle_error(mon, &err);
}
void hmp_block_resize(Monitor *mon, const QDict *qdict)
@ -1534,10 +1532,7 @@ void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict)
Error *err = NULL;
qmp_migrate_set_cache_size(value, &err);
if (err) {
error_report_err(err);
return;
}
hmp_handle_error(mon, &err);
}
/* Kept for backwards compatibility */
@ -1568,10 +1563,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
end:
qapi_free_MigrationCapabilityStatusList(caps);
if (err) {
error_report_err(err);
}
hmp_handle_error(mon, &err);
}
void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
@ -1680,9 +1672,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
cleanup:
qapi_free_MigrateSetParameters(p);
visit_free(v);
if (err) {
error_report_err(err);
}
hmp_handle_error(mon, &err);
}
void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
@ -1936,7 +1926,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, &err);
if (err) {
error_report_err(err);
hmp_handle_error(mon, &err);
return;
}

View File

@ -200,7 +200,7 @@ struct Monitor {
ReadLineState *rs;
MonitorQMP qmp;
CPUState *mon_cpu;
gchar *mon_cpu_path;
BlockCompletionFunc *password_completion_cb;
void *password_opaque;
mon_cmd_t *cmd_table;
@ -579,6 +579,7 @@ static void monitor_data_init(Monitor *mon)
static void monitor_data_destroy(Monitor *mon)
{
g_free(mon->mon_cpu_path);
qemu_chr_fe_deinit(&mon->chr, false);
if (monitor_is_qmp(mon)) {
json_message_parser_destroy(&mon->qmp.parser);
@ -1047,20 +1048,32 @@ int monitor_set_cpu(int cpu_index)
if (cpu == NULL) {
return -1;
}
cur_mon->mon_cpu = cpu;
g_free(cur_mon->mon_cpu_path);
cur_mon->mon_cpu_path = object_get_canonical_path(OBJECT(cpu));
return 0;
}
CPUState *mon_get_cpu(void)
{
if (!cur_mon->mon_cpu) {
CPUState *cpu;
if (cur_mon->mon_cpu_path) {
cpu = (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_path,
TYPE_CPU, NULL);
if (!cpu) {
g_free(cur_mon->mon_cpu_path);
cur_mon->mon_cpu_path = NULL;
}
}
if (!cur_mon->mon_cpu_path) {
if (!first_cpu) {
return NULL;
}
monitor_set_cpu(first_cpu->cpu_index);
cpu = first_cpu;
}
cpu_synchronize_state(cur_mon->mon_cpu);
return cur_mon->mon_cpu;
cpu_synchronize_state(cpu);
return cpu;
}
CPUArchState *mon_get_cpu_env(void)