From: Rusty Russell Date: Mon, 30 Jul 2007 06:41:57 +0000 (+1000) Subject: KVM: Remove three magic numbers X-Git-Tag: v2.6.24-rc1~1365^2~73 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3077c4513c46f66537c1205acc464e49c9847dc0;p=linux-2.6 KVM: Remove three magic numbers There are several places where hardcoded numbers are used in place of the easily-available constant, which is poor form. Signed-off-by: Rusty Russell Signed-off-by: Avi Kivity --- diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 5b42731beb..6ad1b04f30 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -413,7 +413,7 @@ static void free_pio_guest_pages(struct kvm_vcpu *vcpu) { int i; - for (i = 0; i < 2; ++i) + for (i = 0; i < ARRAY_SIZE(vcpu->pio.guest_pages); ++i) if (vcpu->pio.guest_pages[i]) { __free_page(vcpu->pio.guest_pages[i]); vcpu->pio.guest_pages[i] = NULL; diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 9a840e08b2..c18f0b2d3d 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -241,7 +241,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) printk(KERN_DEBUG "%s: NOP\n", __FUNCTION__); return; } - if (svm->next_rip - svm->vmcb->save.rip > 15) { + if (svm->next_rip - svm->vmcb->save.rip > MAX_INST_SIZE) { printk(KERN_ERR "%s: ip 0x%llx next 0x%llx\n", __FUNCTION__, svm->vmcb->save.rip,