Skip to content

Commit a50abc3

Browse files
mstsirkinavikivity
authored andcommitted
KVM: use symbolic constant for nr interrupts
interrupt_bitmap is KVM_NR_INTERRUPTS bits in size, so just use that instead of hard-coded constants and math. Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent b3356bf commit a50abc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
23662366
static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
23672367
struct kvm_interrupt *irq)
23682368
{
2369-
if (irq->irq < 0 || irq->irq >= 256)
2369+
if (irq->irq < 0 || irq->irq >= KVM_NR_INTERRUPTS)
23702370
return -EINVAL;
23712371
if (irqchip_in_kernel(vcpu->kvm))
23722372
return -ENXIO;
@@ -5793,7 +5793,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
57935793
if (mmu_reset_needed)
57945794
kvm_mmu_reset_context(vcpu);
57955795

5796-
max_bits = (sizeof sregs->interrupt_bitmap) << 3;
5796+
max_bits = KVM_NR_INTERRUPTS;
57975797
pending_vec = find_first_bit(
57985798
(const unsigned long *)sregs->interrupt_bitmap, max_bits);
57995799
if (pending_vec < max_bits) {

0 commit comments

Comments
 (0)