[PATCH] KVM: arm64: fix potential bug
From: John Gong
Date: Mon Mar 11 2019 - 20:33:09 EST
Since intid always >= VGIC_NR_PRIVATE_IRQS, so then even vcpu == NULL,
it never return -EINVAL.
Signed-off-by: Shengmin Gong <shengmin.gong@xxxxxxxxx>
Signed-off-by: John Gong <johngong0791@xxxxxxxxx>
---
virt/kvm/arm/vgic/vgic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index abd9c7352677..d3cb1ce880e2 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -424,7 +424,7 @@ int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
return ret;
vcpu = kvm_get_vcpu(kvm, cpuid);
- if (!vcpu && intid < VGIC_NR_PRIVATE_IRQS)
+ if (!vcpu)
return -EINVAL;
irq = vgic_get_irq(kvm, vcpu, intid);
--
2.17.1