Module Name:    src
Committed By:   mrg
Date:           Mon Apr 12 09:22:58 UTC 2021

Modified Files:
        src/sys/dev/nvmm: nvmm.c

Log Message:
be sure to only access vcpu if it was initialised.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/nvmm/nvmm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.42 src/sys/dev/nvmm/nvmm.c:1.43
--- src/sys/dev/nvmm/nvmm.c:1.42	Fri Mar 26 15:59:53 2021
+++ src/sys/dev/nvmm/nvmm.c	Mon Apr 12 09:22:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.42 2021/03/26 15:59:53 reinoud Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.43 2021/04/12 09:22:58 mrg Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.42 2021/03/26 15:59:53 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.43 2021/04/12 09:22:58 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -603,7 +603,7 @@ static int
 nvmm_vcpu_run(struct nvmm_owner *owner, struct nvmm_ioc_vcpu_run *args)
 {
 	struct nvmm_machine *mach;
-	struct nvmm_cpu *vcpu;
+	struct nvmm_cpu *vcpu = NULL;
 	int error;
 
 	error = nvmm_machine_get(owner, args->machid, &mach, false);
@@ -619,7 +619,8 @@ nvmm_vcpu_run(struct nvmm_owner *owner, 
 
 out:
 	nvmm_machine_put(mach);
-	vcpu->comm->stop = 0;
+	if (vcpu)
+		vcpu->comm->stop = 0;
 	return error;
 }
 

Reply via email to