Skip to content

Commit 31bed55

Browse files
ehabkostafaerber
authored andcommitted
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 <[email protected]> Signed-off-by: Andreas Färber <[email protected]>
1 parent 5185f0e commit 31bed55

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

qdev-monitor.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,9 @@ int qdev_device_help(QemuOpts *opts)
235235
return 0;
236236
}
237237

238-
if (!object_class_by_name(driver)) {
239-
const char *typename = find_typename_by_alias(driver);
240-
241-
if (typename) {
242-
driver = typename;
243-
}
238+
qdev_get_device_class(&driver, &local_err);
239+
if (local_err) {
240+
goto error;
244241
}
245242

246243
prop_list = qmp_device_list_properties(driver, &local_err);

0 commit comments

Comments
 (0)