* [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry()
@ 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 11:38 ` [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Joerg Roedel
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-05-18 7:38 UTC (permalink / raw)
To: Joerg Roedel
Cc: Paolo Bonzini, Radim Krčmář, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86, kvm, kernel-janitors
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)
{
u64 *avic_physical_id_table;
struct kvm_arch *vm_data = &vcpu->kvm->arch;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions()
2017-05-18 7:38 [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Dan Carpenter
@ 2017-05-18 7:39 ` Dan Carpenter
2017-05-18 11:39 ` Joerg Roedel
2017-05-18 11:38 ` [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Joerg Roedel
1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2017-05-18 7:39 UTC (permalink / raw)
To: Joerg Roedel
Cc: Paolo Bonzini, Radim Krčmář, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86, kvm, kernel-janitors
I moved the || to the line before. Also I replaced some spaces with a
tab on the "return 0;" line. It looks OK in the diff but originally
that line was only indented 7 spaces.
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..226954f8106f 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2370,8 +2371,8 @@ static void nested_svm_uninit_mmu_context(struct kvm_vcpu *vcpu)
static int nested_svm_check_permissions(struct vcpu_svm *svm)
{
- if (!(svm->vcpu.arch.efer & EFER_SVME)
- || !is_paging(&svm->vcpu)) {
+ if (!(svm->vcpu.arch.efer & EFER_SVME) ||
+ !is_paging(&svm->vcpu)) {
kvm_queue_exception(&svm->vcpu, UD_VECTOR);
return 1;
}
@@ -2381,7 +2382,7 @@ static int nested_svm_check_permissions(struct vcpu_svm *svm)
return 1;
}
- return 0;
+ return 0;
}
static int nested_svm_check_exception(struct vcpu_svm *svm, unsigned nr,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry()
2017-05-18 7:38 [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Dan Carpenter
2017-05-18 7:39 ` [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions() Dan Carpenter
@ 2017-05-18 11:38 ` Joerg Roedel
1 sibling, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2017-05-18 11:38 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paolo Bonzini, Radim Krčmář, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86, kvm, kernel-janitors
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions()
2017-05-18 7:39 ` [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions() Dan Carpenter
@ 2017-05-18 11:39 ` Joerg Roedel
0 siblings, 0 replies; 4+ messages in thread
From: Joerg Roedel @ 2017-05-18 11:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paolo Bonzini, Radim Krčmář, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, x86, kvm, kernel-janitors
On Thu, May 18, 2017 at 10:39:53AM +0300, Dan Carpenter wrote:
> I moved the || to the line before. Also I replaced some spaces with a
> tab on the "return 0;" line. It looks OK in the diff but originally
> that line was only indented 7 spaces.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-18 11:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 7:38 [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Dan Carpenter
2017-05-18 7:39 ` [PATCH 2/2] KVM: Tidy the whitespace in nested_svm_check_permissions() Dan Carpenter
2017-05-18 11:39 ` Joerg Roedel
2017-05-18 11:38 ` [PATCH 1/2] KVM: Silence underflow warning in avic_get_physical_id_entry() Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).