[PATCH] KVM: powerpc: beyond ARRAY_SIZE of vcpu->arch.guest_tlb

Roel Kluin roel.kluin at gmail.com
Fri May 22 05:53:13 EST 2009


Do not go beyond ARRAY_SIZE of vcpu->arch.guest_tlb

Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
---
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 0fce4fb..c2cfd46 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -125,7 +125,7 @@ static int kvmppc_emul_tlbwe(struct kvm_vcpu *vcpu, u32 inst)
 	ws = get_ws(inst);
 
 	index = vcpu->arch.gpr[ra];
-	if (index > PPC44x_TLB_SIZE) {
+	if (index >= PPC44x_TLB_SIZE) {
 		printk("%s: index %d\n", __func__, index);
 		kvmppc_dump_vcpu(vcpu);
 		return EMULATE_FAIL;




More information about the Linuxppc-dev mailing list