From: Dan Carpenter Date: Thu, 18 May 2017 07:38:53 +0000 (+0300) Subject: KVM: Silence underflow warning in avic_get_physical_id_entry() X-Git-Tag: v4.12-rc2~17^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3e7dec054174fdddae33eaa0032a82c3f42181d;p=thirdparty%2Flinux.git KVM: Silence underflow warning in avic_get_physical_id_entry() Smatch complains that we check cap the upper bound of "index" but don't check for negatives. It's a false positive because "index" is never negative. But it's also simple enough to make it unsigned which makes the code easier to audit. Signed-off-by: Dan Carpenter Signed-off-by: Radim Krčmář --- diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c27ac6923a184..183ddb235fb48 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1272,7 +1272,8 @@ static void init_vmcb(struct vcpu_svm *svm) } -static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, int index) +static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, + unsigned int index) { u64 *avic_physical_id_table; struct kvm_arch *vm_data = &vcpu->kvm->arch;