Re: [PATCH] kvm: Fix off by one in kvm_for_each_vcpu iteration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/13/2011 04:30 AM, Jeff Mahoney wrote:
  This patch avoids gcc issuing the following warning when KVM_MAX_VCPUS=1:
  warning: array subscript is above array bounds

  kvm_for_each_vcpu currently checks to see if the index for the vcpu is
  valid /after/ loading it. We don't run into problems because the address
  is still inside the enclosing struct kvm and we never deference or write
  to it, so this isn't a security issue.

  The warning occurs when KVM_MAX_VCPUS=1 because the increment portion of
  the loop will *always* cause the loop to load an invalid location since
  ++idx will always be>  0.

  This patch moves the load so that the check occurs before the load and
  we don't run into the compiler warning.

Applied, thanks.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux