From: Sasha Levin Subject: [PATCH 2/2] kvm tools: Initialize irq_routing before using it Date: Tue, 6 Dec 2011 14:15:31 +0200 Message-ID: <1323173731-7651-2-git-send-email-levinsasha928@gmail.com> References: <1323173731-7651-1-git-send-email-levinsasha928@gmail.com> Cc: mingo@elte.hu, gorcunov@gmail.com, asias.hejun@gmail.com, kvm@vger.kernel.org, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:34879 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933368Ab1LFMP4 (ORCPT ); Tue, 6 Dec 2011 07:15:56 -0500 Received: by eaak14 with SMTP id k14so5022966eaa.19 for ; Tue, 06 Dec 2011 04:15:55 -0800 (PST) In-Reply-To: <1323173731-7651-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Initialize irq_routing, and specifically irq_routing->nr before using it. Signed-off-by: Sasha Levin --- 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