Remove three magic numbers
PATCH 1/1 Remove three magic numbers
There are several places where hardcoded numbers are used in place of the easily-available constant, which is poor form.
drivers/kvm/kvm_main.c +1 -1
@@ -2284,7 +2284,7 @@ static int kvm_vcpu_ioctl_interrupt(strustatic int kvm_vcpu_ioctl_interrupt (struct kvm_vcpu *vcpu,struct kvm_interrupt *irq) { -if (irq->irq <0 || irq->irq >=256 ) +if (irq->irq <0 || irq->irq >=KVM_NR_INTERRUPTS )return -EINVAL ;vcpu_load (vcpu);push_irq (vcpu, irq->irq);
drivers/kvm/svm.c +1 -1
@@ -241,7 +241,7 @@ static void skip_emulated_instruction(stpr_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,
drivers/kvm/kvm_main.c +1 -1
@@ -354,7 +354,7 @@ static void free_pio_guest_pages(struct {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 ;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 1185777717.12151.160.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Avi Kivity
AppliedQuoted 4 lines · Rusty Russell
There are several places where hardcoded numbers are used in place of the easily-available constant, which is poor form.
Applied, thanks.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/