diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2014-11-01 13:56:11 -0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-11-04 17:50:00 +0100 |
commit | 31bed5509dfcbdfc293154ce81086a4dbd7a80b6 (patch) | |
tree | f0fb787080a8bf9aea449baaed1e08e373e1f819 /qdev-monitor.c | |
parent | 5185f0e0a6bb076cd1cd0115ef785298a97a71fe (diff) | |
download | qemu-31bed5509dfcbdfc293154ce81086a4dbd7a80b6.zip qemu-31bed5509dfcbdfc293154ce81086a4dbd7a80b6.tar.gz qemu-31bed5509dfcbdfc293154ce81086a4dbd7a80b6.tar.bz2 |
qdev: Use qdev_get_device_class() for -device <type>,help
Make sure we try to list properties from classes that can be safely used
with "-device".
Fixes the following crashes:
$ qemu-system-x86_64 -device x86_64-cpu,help
**
ERROR:qom/object.c:336:object_initialize_with_type: assertion failed: (type->abstract == false)
Aborted (core dumped)
$ qemu-system-x86_64 -device host-x86_64-cpu,help
qemu-system-x86_64: [...]/target-i386/cpu.c:1329: host_x86_cpu_initfn: Assertion `(kvm_allowed)' failed.
Aborted (core dumped)
After applying this patch:
$ qemu-system-x86_64 -device x86_64-cpu,help
Parameter 'driver' expects non-abstract device type
$ qemu-system-x86_64 -device host-x86_64-cpu,help
Parameter 'driver' expects pluggable device type
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r-- | qdev-monitor.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c index a9702d8..ebfa701 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -235,12 +235,9 @@ int qdev_device_help(QemuOpts *opts) return 0; } - if (!object_class_by_name(driver)) { - const char *typename = find_typename_by_alias(driver); - - if (typename) { - driver = typename; - } + qdev_get_device_class(&driver, &local_err); + if (local_err) { + goto error; } prop_list = qmp_device_list_properties(driver, &local_err); |