Revert "ANDROID: KVM: arm64: get_shadow_vcpu()'s vcpu_idx should be unsigned"

This reverts commit 29e2f13805.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I5f56923c8681390124ecc8e0afd523284da5ba1d
This commit is contained in:
Will Deacon
2022-07-07 15:49:09 +01:00
parent 17ff52af66
commit 846dfa1ddd
2 changed files with 3 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ extern phys_addr_t pvmfw_size;
int __pkvm_init_shadow(struct kvm *kvm, void *shadow_va, size_t size, void *pgd);
int __pkvm_teardown_shadow(int shadow_handle);
struct kvm_vcpu *get_shadow_vcpu(int shadow_handle, unsigned int vcpu_idx);
struct kvm_vcpu *get_shadow_vcpu(int shadow_handle, int vcpu_idx);
void put_shadow_vcpu(struct kvm_vcpu *vcpu);
u64 pvm_read_id_reg(const struct kvm_vcpu *vcpu, u32 id);

View File

@@ -257,14 +257,14 @@ static struct kvm_shadow_vm *find_shadow_by_handle(int shadow_handle)
return shadow_table[shadow_index];
}
struct kvm_vcpu *get_shadow_vcpu(int shadow_handle, unsigned int vcpu_idx)
struct kvm_vcpu *get_shadow_vcpu(int shadow_handle, int vcpu_idx)
{
struct kvm_vcpu *vcpu = NULL;
struct kvm_shadow_vm *vm;
hyp_spin_lock(&shadow_lock);
vm = find_shadow_by_handle(shadow_handle);
if (!vm || vm->created_vcpus <= vcpu_idx)
if (!vm || vcpu_idx < 0 || vm->created_vcpus <= vcpu_idx)
goto unlock;
vcpu = &vm->shadow_vcpus[vcpu_idx].vcpu;