All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch RFC] kvm, cpuid: silence a buffer overflow warning
@ 2014-02-20 12:34 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2014-02-20 12:34 UTC (permalink / raw)
  To: Gleb Natapov
  Cc: Paolo Bonzini, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	kvm, kernel-janitors

This seems like a harmless off by one overflow if "i" is the last
element in the vcpu->arch.cpuid_entries[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested.  I always wonder if it's worth fixing these or if it's worth
reporting them?  Either of those seem like a lot of work for something
harmless.

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index c6976257eff5..7d02c0fc768c 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -660,7 +660,7 @@ static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i)
 
 	e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT;
 	/* when no next entry is found, the current entry[i] is reselected */
-	for (j = i + 1; ; j = (j + 1) % nent) {
+	for (j = (i + 1) % nent; ; j = (j + 1) % nent) {
 		struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j];
 		if (ej->function = e->function) {
 			ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT;

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-20 13:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 12:34 [patch RFC] kvm, cpuid: silence a buffer overflow warning Dan Carpenter
2014-02-20 12:34 ` Dan Carpenter
2014-02-20 13:07 ` Paolo Bonzini
2014-02-20 13:07   ` Paolo Bonzini
2014-02-20 13:18   ` walter harms
2014-02-20 13:18     ` walter harms
2014-02-20 13:19     ` Paolo Bonzini
2014-02-20 13:19       ` Paolo Bonzini
2014-02-20 13:23   ` Dan Carpenter
2014-02-20 13:23     ` Dan Carpenter

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.