From patchwork Wed Feb 6 08:19:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 2102591 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1ED52DFE82 for ; Wed, 6 Feb 2013 08:19:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751745Ab3BFIT1 (ORCPT ); Wed, 6 Feb 2013 03:19:27 -0500 Received: from ozlabs.org ([203.10.76.45]:48336 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470Ab3BFIT0 (ORCPT ); Wed, 6 Feb 2013 03:19:26 -0500 Received: by ozlabs.org (Postfix, from userid 1034) id 17D4C2C02ED; Wed, 6 Feb 2013 19:19:25 +1100 (EST) From: Michael Ellerman To: Cc: , Subject: [PATCH 4/6] kvm tools: powerpc: Fix buglet in xics_init() handling of nrcpus Date: Wed, 6 Feb 2013 19:19:14 +1100 Message-Id: <1360138756-1991-4-git-send-email-michael@ellerman.id.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360138756-1991-1-git-send-email-michael@ellerman.id.au> References: <1360138756-1991-1-git-send-email-michael@ellerman.id.au> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org In xics_init() we set the maximum server to kvm->nrcpus, and then set the nr_servers using maximum server + 1. That is off by one, in the harmless direction. Simplify it to just set nr_servers = kvm->nrcpus. Signed-off-by: Michael Ellerman --- tools/kvm/powerpc/xics.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/kvm/powerpc/xics.c b/tools/kvm/powerpc/xics.c index d4b5caa..cf64a08 100644 --- a/tools/kvm/powerpc/xics.c +++ b/tools/kvm/powerpc/xics.c @@ -445,16 +445,13 @@ static void rtas_int_on(struct kvm_cpu *vcpu, uint32_t token, static int xics_init(struct kvm *kvm) { - int max_server_num; unsigned int i; struct icp_state *icp; struct ics_state *ics; int j; - max_server_num = kvm->nrcpus; - icp = malloc(sizeof(*icp)); - icp->nr_servers = max_server_num + 1; + icp->nr_servers = kvm->nrcpus; icp->ss = malloc(icp->nr_servers * sizeof(struct icp_server_state)); for (i = 0; i < icp->nr_servers; i++) {