diff options
author | Neel Natu <neel@FreeBSD.org> | 2014-12-30 23:38:31 +0000 |
---|---|---|
committer | Neel Natu <neel@FreeBSD.org> | 2014-12-30 23:38:31 +0000 |
commit | cd86d3634b1cf77632a00db75a18ceee12526bb9 (patch) | |
tree | 3774e0e1662f3b76514036e1169d6a71a6ca8e5e /sys/amd64 | |
parent | 3e4930b0a9a1dec52cf170ea681474243a2d2a1f (diff) | |
download | src-cd86d3634b1cf77632a00db75a18ceee12526bb9.tar.gz src-cd86d3634b1cf77632a00db75a18ceee12526bb9.zip |
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
Notes
Notes:
svn path=/head/; revision=276432
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/vmm/amd/svm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c index ab47041b4d88..f1cb7d6f5b83 100644 --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -1322,9 +1322,12 @@ svm_vmexit(struct svm_softc *svm_sc, int vcpu, struct vm_exit *vmexit) 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); |