Initialize irq_routing, and specifically irq_routing->nr before using it. Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> --- tools/kvm/x86/irq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kvm/x86/irq.c b/tools/kvm/x86/irq.c index 1392dfb..b8a7257 100644 --- a/tools/kvm/x86/irq.c +++ b/tools/kvm/x86/irq.c @@ -140,8 +140,8 @@ void irq__init(struct kvm *kvm) { int i, r; - irq_routing = malloc(sizeof(struct kvm_irq_routing) + - IRQ_MAX_GSI * sizeof(struct kvm_irq_routing_entry)); + irq_routing = calloc(sizeof(struct kvm_irq_routing) + + IRQ_MAX_GSI * sizeof(struct kvm_irq_routing_entry), 1); if (irq_routing == NULL) die("Failed allocating space for GSI table"); -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html