mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-06-16 02:15:47 +00:00
kvm tools: die if init_list__init returns failure
If init_list__init returns failure when initialising kvm tool, we can't rely on our structures being fully initialised, so die rather than try to continue and fail gracefully later on. This prevents a SEGV when kvm is not available on the host: Error: '/dev/kvm' not found. Please make sure your kernel has CONFIG_KVM enabled and that the KVM modules are loaded. Warning: Failed init: kvm__init Segmentation fault Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
+2
-1
@@ -665,7 +665,8 @@ static struct kvm *kvm_cmd_run_init(int argc, const char **argv)
|
||||
printf(" # %s run -k %s -m %Lu -c %d --name %s\n", KVM_BINARY_NAME,
|
||||
kvm->cfg.kernel_filename, kvm->cfg.ram_size / 1024 / 1024, kvm->cfg.nrcpus, kvm->cfg.guest_name);
|
||||
|
||||
init_list__init(kvm);
|
||||
if (init_list__init(kvm) < 0)
|
||||
die ("Initialisation failed");
|
||||
|
||||
return kvm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user