kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [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

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).