aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorAhmed S. Darwish <darwish.07@gmail.com>2007-02-19 07:37:46 -0500
committerAvi Kivity <avi@qumranet.com>2007-03-04 04:12:39 -0500
commit9d8f549dc69b1fc65d0b03916c02f12ca49b3ea0 (patch)
tree938b47ff9c507b266ea57713cc2233b59b6850df /drivers/kvm/svm.c
parentde979caacca51c929d2cc2f0f79611ee4a1bc8a5 (diff)
KVM: Use ARRAY_SIZE macro instead of manual calculation.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com> Signed-off-by: Dor Laor <dor.laor@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 31836444bc62..72cac0488b31 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h>
18#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20#include <linux/profile.h> 21#include <linux/profile.h>
@@ -75,7 +76,7 @@ struct svm_init_data {
75 76
76static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; 77static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000};
77 78
78#define NUM_MSR_MAPS (sizeof(msrpm_ranges) / sizeof(*msrpm_ranges)) 79#define NUM_MSR_MAPS ARRAY_SIZE(msrpm_ranges)
79#define MSRS_RANGE_SIZE 2048 80#define MSRS_RANGE_SIZE 2048
80#define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2) 81#define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2)
81 82
@@ -1297,7 +1298,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1297 __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info, 1298 __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info,
1298 exit_code); 1299 exit_code);
1299 1300
1300 if (exit_code >= sizeof(svm_exit_handlers) / sizeof(*svm_exit_handlers) 1301 if (exit_code >= ARRAY_SIZE(svm_exit_handlers)
1301 || svm_exit_handlers[exit_code] == 0) { 1302 || svm_exit_handlers[exit_code] == 0) {
1302 kvm_run->exit_reason = KVM_EXIT_UNKNOWN; 1303 kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
1303 printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", 1304 printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n",