qom: fix objects with improper parent type

Some objects accidentally inherit ObjectClass instead of Object.
They compile silently but may crash after downcasting.

In this patch, we introduce a coccinelle script to find broken
declarations and fix them manually with proper base type.

Signed-off-by: Sergey Nizovtsev <snizovtsev@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-10-07 12:23:56 -04:00
parent d9f24bf572
commit 22fb6eb571
5 changed files with 30 additions and 3 deletions

View file

@ -24,7 +24,7 @@ DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO,
typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo;
struct VMCoreInfoState {
DeviceClass parent_obj;
DeviceState parent_obj;
bool has_vmcoreinfo;
FWCfgVMCoreInfo vmcoreinfo;