Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: KVM: Remove dead code of TLB index error in kvm_mips_emul_tlbwr()

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>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Deng-Cheng Zhu and committed by
Paolo Bonzini
ab76228a db2fb7f2

-5
-5
arch/mips/kvm/emulate.c
··· 846 846 get_random_bytes(&index, sizeof(index)); 847 847 index &= (KVM_MIPS_GUEST_TLB_SIZE - 1); 848 848 849 - if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) { 850 - kvm_err("%s: illegal index: %d\n", __func__, index); 851 - return EMULATE_FAIL; 852 - } 853 - 854 849 tlb = &vcpu->arch.guest_tlb[index]; 855 850 856 851 /*