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>
This commit is contained in:
committed by
Avi Kivity
parent
de979caacc
commit
9d8f549dc6
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/profile.h>
|
||||
@ -75,7 +76,7 @@ struct svm_init_data {
|
||||
|
||||
static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000};
|
||||
|
||||
#define NUM_MSR_MAPS (sizeof(msrpm_ranges) / sizeof(*msrpm_ranges))
|
||||
#define NUM_MSR_MAPS ARRAY_SIZE(msrpm_ranges)
|
||||
#define MSRS_RANGE_SIZE 2048
|
||||
#define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2)
|
||||
|
||||
@ -1297,7 +1298,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||
__FUNCTION__, vcpu->svm->vmcb->control.exit_int_info,
|
||||
exit_code);
|
||||
|
||||
if (exit_code >= sizeof(svm_exit_handlers) / sizeof(*svm_exit_handlers)
|
||||
if (exit_code >= ARRAY_SIZE(svm_exit_handlers)
|
||||
|| svm_exit_handlers[exit_code] == 0) {
|
||||
kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
|
||||
printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n",
|
||||
|
Reference in New Issue
Block a user