]> Pileus Git - ~andy/linux/commitdiff
KVM: Remove three magic numbers
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Jul 2007 06:41:57 +0000 (16:41 +1000)
committerAvi Kivity <avi@qumranet.com>
Sat, 13 Oct 2007 08:18:21 +0000 (10:18 +0200)
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 <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c
drivers/kvm/svm.c

index 5b42731beba41fd865235736172189468232b6b4..6ad1b04f3099e5e07f055684cad0f59c9460c912 100644 (file)
@@ -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;
index 9a840e08b2074523dba0f6ea27f33efd923d1a06..c18f0b2d3d3e0be285d3dfcf7758d68848c9f017 100644 (file)
@@ -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,