Skip to contentSkip to conversation

KVM: ppc: beyond ARRAY_SIZE of vcpu_44x->guest_tlb

PATCH In review Roel Kluin 2 participants 2 messages May 19, 2009 – May 20, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 KVM: ppc: beyond ARRAY_SIZE of vcpu_44x->guest_tlb

Do not go beyond ARRAY_SIZE of vcpu_44x->guest_tlb

---

arch/powerpc/kvm/44x_tlb.c +1 -1
index 4a16f47..6093289 100644
@@ -439,7 +439,7 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
 	unsigned int gtlb_index;
 
 	gtlb_index = vcpu->arch.gpr[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;
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Roel Kluin

Do not go beyond ARRAY_SIZE of vcpu_44x->guest_tlb

---

arch/powerpc/kvm/44x_tlb.c +0 -0
index 4a16f47..6093289 100644

arch/powerpc/kvm/44x_tlb.c int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws) · line 445

Quoted 8 lines
arch/powerpc/kvm/44x_tlb.c +1 -1
@@ -439,7 +439,7 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
 	unsigned int gtlb_index;
 
 	gtlb_index = vcpu->arch.gpr[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;

Thanks.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center