linux-mips
[Top] [All Lists]

[PATCH v4 7/7] MIPS: KVM: Remove dead code of TLB index error in kvm_mip

To: <pbonzini@redhat.com>
Subject: [PATCH v4 7/7] MIPS: KVM: Remove dead code of TLB index error in kvm_mips_emul_tlbwr()
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Date: Thu, 26 Jun 2014 12:11:40 -0700
Cc: <gleb@kernel.org>, <kvm@vger.kernel.org>, <sanjayl@kymasys.com>, <james.hogan@imgtec.com>, <ralf@linux-mips.org>, <linux-mips@linux-mips.org>, <dengcheng.zhu@imgtec.com>
In-reply-to: <1403809900-17454-1-git-send-email-dengcheng.zhu@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1403809900-17454-1-git-send-email-dengcheng.zhu@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>

It's impossible to fall into the error handling of the TLB index after
being masked by (KVM_MIPS_GUEST_TLB_SIZE - 1). Remove the dead code.

Reported-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
---
 arch/mips/kvm/emulate.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index 1a60688..fb3e8df 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -846,11 +846,6 @@ enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu 
*vcpu)
        get_random_bytes(&index, sizeof(index));
        index &= (KVM_MIPS_GUEST_TLB_SIZE - 1);
 
-       if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) {
-               kvm_err("%s: illegal index: %d\n", __func__, index);
-               return EMULATE_FAIL;
-       }
-
        tlb = &vcpu->arch.guest_tlb[index];
 
        /*
-- 
1.8.5.3


<Prev in Thread] Current Thread [Next in Thread>