Skip to content

Commit

Permalink
hw/arm/virt: Check that the CPU realize method succeeded
Browse files Browse the repository at this point in the history
We were passing a NULL error pointer to the object_property_set_bool()
call that realizes the CPU object. This meant that we wouldn't detect
failure, and would plough blindly on to crash later trying to use a
NULL CPU object pointer. Detect errors and fail instead.

In particular, this will be necessary to detect the user error
of using "-cpu host" without "-enable-kvm" once we make the host
CPU type be registered unconditionally rather than only in
kvm_arch_init().

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Jan 25, 2018
1 parent 421a3c2 commit c88bc3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/arm/virt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ static void machvirt_init(MachineState *machine)
"secure-memory", &error_abort);
}

object_property_set_bool(cpuobj, true, "realized", NULL);
object_property_set_bool(cpuobj, true, "realized", &error_fatal);
object_unref(cpuobj);
}
fdt_add_timer_nodes(vms);
Expand Down

0 comments on commit c88bc3e

Please sign in to comment.