From: Joerg Roedel <joro@8bytes.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, kvm@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry()
Date: Thu, 18 May 2017 11:38:48 +0000 [thread overview]
Message-ID: <20170518113848.GE1912@8bytes.org> (raw)
In-Reply-To: <20170518073853.b3dkw2zibj7ayvwh@mwanda>
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 <dan.carpenter@oracle.com>
>
> 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
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, kvm@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry()
Date: Thu, 18 May 2017 13:38:48 +0200 [thread overview]
Message-ID: <20170518113848.GE1912@8bytes.org> (raw)
In-Reply-To: <20170518073853.b3dkw2zibj7ayvwh@mwanda>
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 <dan.carpenter@oracle.com>
>
> 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
next prev parent reply other threads:[~2017-05-18 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 7:38 [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Dan Carpenter
2017-05-18 7:38 ` Dan Carpenter
2017-05-18 7:39 ` [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions() Dan Carpenter
2017-05-18 7:39 ` Dan Carpenter
2017-05-18 11:39 ` Joerg Roedel
2017-05-18 11:39 ` Joerg Roedel
2017-05-18 11:38 ` Joerg Roedel [this message]
2017-05-18 11:38 ` [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170518113848.GE1912@8bytes.org \
--to=joro@8bytes.org \
--cc=dan.carpenter@oracle.com \
--cc=hpa@zytor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.