Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/nvmm be sure to only access vcpu if it was initialised.



details:   https://anonhg.NetBSD.org/src/rev/5bb1499feff9
branches:  trunk
changeset: 982404:5bb1499feff9
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Apr 12 09:22:58 2021 +0000

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

diffstat:

 sys/dev/nvmm/nvmm.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 2c4f0b65829e -r 5bb1499feff9 sys/dev/nvmm/nvmm.c
--- a/sys/dev/nvmm/nvmm.c       Mon Apr 12 09:22:21 2021 +0000
+++ b/sys/dev/nvmm/nvmm.c       Mon Apr 12 09:22:58 2021 +0000
@@ -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 @@
 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 @@
 
 out:
        nvmm_machine_put(mach);
-       vcpu->comm->stop = 0;
+       if (vcpu)
+               vcpu->comm->stop = 0;
        return error;
 }
 



Home | Main Index | Thread Index | Old Index