Skip to contentSkip to conversation

Keep index within boundaries in kvmppc_44x_emul_tlbwe()

PATCH Applied Roel Kluin 4 participants 5 messages May 9, 2010 – May 12, 2010

Subsystems (3)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

An index of KVM44x_GUEST_TLB_SIZE is already one too large.

---
 arch/powerpc/kvm/44x_tlb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kvm/44x_tlb.c +1 -1
index 2570fcc..8123125 100644
@@ -440,7 +440,7 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
 	unsigned int gtlb_index;
 
 	gtlb_index = kvmppc_get_gpr(vcpu, ra);
-	if (gtlb_index > KVM44x_GUEST_TLB_SIZE) {
+	if (gtlb_index >= KVM44x_GUEST_TLB_SIZE) {
 		printk("%s: index %d\n", __func__, gtlb_index);
 		kvmppc_dump_vcpu(vcpu);
 		return EMULATE_FAIL;
#1 lore raw
Quoted 2 lines · Roel Kluin

An index of KVM44x_GUEST_TLB_SIZE is already one too large.

Thanks for this one Roel. Please try to keep kvm@vger CC'ed on KVM patches, as all KVM patches go through kvm.git.

Hollis, I'd like to see an Ack from you on this patch. It looks reasonable to me, but I'd still feel better if there was some word from you on it.

Alex