Skip to content

Commit

Permalink
MIPS: KVM: Remove dead code of TLB index error in kvm_mips_emul_tlbwr()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Deng-Cheng Zhu <[email protected]>
Reviewed-by: James Hogan <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
dczhu authored and bonzini committed Jun 30, 2014
1 parent db2fb7f commit ab76228
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions arch/mips/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

/*
Expand Down

0 comments on commit ab76228

Please sign in to comment.