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

Subsystems: kernel virtual machine for powerpc (kvm/powerpc), linux for powerpc (32-bit and 64-bit), the rest

STALE6289d

2 messages, 2 authors, 2009-05-31 · open the first message on its own page

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

From: Roel Kluin <hidden>
Date: 2009-05-21 19:53:16

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

Signed-off-by: Roel Kluin <redacted>
---
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;

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

From: Avi Kivity <hidden>
Date: 2009-05-31 12:01:06

Roel Kluin wrote:
quoted hunk
Do not go beyond ARRAY_SIZE of vcpu->arch.guest_tlb

Signed-off-by: Roel Kluin <redacted>
---
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;
  
This code no longer exists in kvm.git.

-- 
error compiling committee.c: too many arguments to function
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help