From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Date: Thu, 18 May 2017 13:38:48 +0200 Message-ID: <20170518113848.GE1912@8bytes.org> References: <20170518073853.b3dkw2zibj7ayvwh@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, kernel-janitors@vger.kernel.org To: Dan Carpenter Return-path: Received: from 8bytes.org ([81.169.241.247]:42560 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932616AbdERLix (ORCPT ); Thu, 18 May 2017 07:38:53 -0400 Content-Disposition: inline In-Reply-To: <20170518073853.b3dkw2zibj7ayvwh@mwanda> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, May 18, 2017 at 10:38:53AM +0300, Dan Carpenter wrote: > 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 > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index c27ac6923a18..183ddb235fb4 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) I would have used 'unsigned', just to annoy checkpatch. But I guess this is ok too :) Joerg