diff options
author | Andrew Cooper <andrew.cooper3@citrix.com> | 2013-09-16 12:22:20 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-09-16 12:22:20 +0200 |
commit | 42c5b1214071d363a52c6356dfe2ed820f500849 (patch) | |
tree | 448f02feb3bc20cbc825ccefc4fda5ac0a407660 /xen/arch/x86/hvm/svm | |
parent | 593470233ff38385df9dcf5690cc58c7a4fb290d (diff) | |
download | xen-42c5b1214071d363a52c6356dfe2ed820f500849.tar.gz xen-42c5b1214071d363a52c6356dfe2ed820f500849.tar.bz2 xen-42c5b1214071d363a52c6356dfe2ed820f500849.zip |
hvm/vpmu: Prevent dump handlers from incorrectly mutating state
Discovered by Coverity, CID 1055181
core2_vpmu_dump() was incorrectly setting VPMU_CONTEXT_LOADED when it
was intending to check for it.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
This would have been avoided if the dump function declared all its
pointers "const" - doing this now (also in SVM).
Also fixing some indentation issues at once.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Diffstat (limited to 'xen/arch/x86/hvm/svm')
-rw-r--r-- | xen/arch/x86/hvm/svm/vpmu.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/xen/arch/x86/hvm/svm/vpmu.c b/xen/arch/x86/hvm/svm/vpmu.c index 4d1fbc8a72..66a381525c 100644 --- a/xen/arch/x86/hvm/svm/vpmu.c +++ b/xen/arch/x86/hvm/svm/vpmu.c @@ -415,10 +415,10 @@ static void amd_vpmu_destroy(struct vcpu *v) } /* VPMU part of the 'q' keyhandler */ -static void amd_vpmu_dump(struct vcpu *v) +static void amd_vpmu_dump(const struct vcpu *v) { - struct vpmu_struct *vpmu = vcpu_vpmu(v); - struct amd_vpmu_context *ctxt = vpmu->context; + const struct vpmu_struct *vpmu = vcpu_vpmu(v); + const struct amd_vpmu_context *ctxt = vpmu->context; unsigned int i; printk(" VPMU state: 0x%x ", vpmu->flags); @@ -447,9 +447,9 @@ static void amd_vpmu_dump(struct vcpu *v) rdmsrl(ctrls[i], ctrl); rdmsrl(counters[i], cntr); - printk(" 0x%08x: 0x%lx (0x%lx in HW) 0x%08x: 0x%lx (0x%lx in HW)\n", - ctrls[i], ctxt->ctrls[i], ctrl, - counters[i], ctxt->counters[i], cntr); + printk(" %#x: %#lx (%#lx in HW) %#x: %#lx (%#lx in HW)\n", + ctrls[i], ctxt->ctrls[i], ctrl, + counters[i], ctxt->counters[i], cntr); } } |