Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Dec 2014 23:38:32 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276432 - head/sys/amd64/vmm/amd
Message-ID:  <201412302338.sBUNcW97032729@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Tue Dec 30 23:38:31 2014
New Revision: 276432
URL: https://svnweb.freebsd.org/changeset/base/276432

Log:
  Initialize all fields of 'struct vm_exception exception' before passing it to
  vm_inject_exception(). This fixes the issue that 'exception.cpuid' is
  uninitialized when calling 'vm_inject_exception()'.
  
  However, in practice this change is a no-op because vm_inject_exception()
  does not use 'exception.cpuid' for anything.
  
  Reported by:    Coverity Scan
  CID:            1261297
  MFC after:      3 days

Modified:
  head/sys/amd64/vmm/amd/svm.c

Modified: head/sys/amd64/vmm/amd/svm.c
==============================================================================
--- head/sys/amd64/vmm/amd/svm.c	Tue Dec 30 22:46:20 2014	(r276431)
+++ head/sys/amd64/vmm/amd/svm.c	Tue Dec 30 23:38:31 2014	(r276432)
@@ -1322,9 +1322,12 @@ svm_vmexit(struct svm_softc *svm_sc, int
 
 		if (reflect) {
 			/* Reflect the exception back into the guest */
+			bzero(&exception, sizeof(struct vm_exception));
 			exception.vector = idtvec;
-			exception.error_code_valid = errcode_valid;
-			exception.error_code = errcode_valid ? info1 : 0;
+			if (errcode_valid) {
+				exception.error_code = info1;
+				exception.error_code_valid = 1;
+			}
 			VCPU_CTR2(svm_sc->vm, vcpu, "Reflecting exception "
 			    "%d/%#x into the guest", exception.vector,
 			    exception.error_code);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412302338.sBUNcW97032729>