kvm: selftests: aarch64: fix the failure check in kvm_set_gsi_routing_irqchip_check
[linux-2.6-microblaze.git] / tools / testing / selftests / kvm / aarch64 / vgic_irq.c
index b701eb8..0106fc4 100644 (file)
@@ -573,8 +573,8 @@ static void kvm_set_gsi_routing_irqchip_check(struct kvm_vm *vm,
                kvm_gsi_routing_write(vm, routing);
        } else {
                ret = _kvm_gsi_routing_write(vm, routing);
-               /* The kernel only checks for KVM_IRQCHIP_NUM_PINS. */
-               if (intid >= KVM_IRQCHIP_NUM_PINS)
+               /* The kernel only checks e->irqchip.pin >= KVM_IRQCHIP_NUM_PINS */
+               if (((uint64_t)intid + num - 1 - MIN_SPI) >= KVM_IRQCHIP_NUM_PINS)
                        TEST_ASSERT(ret != 0 && errno == EINVAL,
                                "Bad intid %u did not cause KVM_SET_GSI_ROUTING "
                                "error: rc: %i errno: %i", intid, ret, errno);