提交 3077c451 编写于 作者: R Rusty Russell 提交者: Avi Kivity

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: NRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NAvi Kivity <avi@qumranet.com>
上级 8b9cf98c
...@@ -413,7 +413,7 @@ static void free_pio_guest_pages(struct kvm_vcpu *vcpu) ...@@ -413,7 +413,7 @@ static void free_pio_guest_pages(struct kvm_vcpu *vcpu)
{ {
int i; 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]) { if (vcpu->pio.guest_pages[i]) {
__free_page(vcpu->pio.guest_pages[i]); __free_page(vcpu->pio.guest_pages[i]);
vcpu->pio.guest_pages[i] = NULL; vcpu->pio.guest_pages[i] = NULL;
......
...@@ -241,7 +241,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) ...@@ -241,7 +241,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
printk(KERN_DEBUG "%s: NOP\n", __FUNCTION__); printk(KERN_DEBUG "%s: NOP\n", __FUNCTION__);
return; 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", printk(KERN_ERR "%s: ip 0x%llx next 0x%llx\n",
__FUNCTION__, __FUNCTION__,
svm->vmcb->save.rip, svm->vmcb->save.rip,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册